]> git.lizzy.rs Git - rust.git/commitdiff
remove -Znll -- borrowck=mir implies nll now
authorNiko Matsakis <niko@alum.mit.edu>
Mon, 9 Apr 2018 09:28:00 +0000 (05:28 -0400)
committerNiko Matsakis <niko@alum.mit.edu>
Sun, 15 Apr 2018 11:13:42 +0000 (07:13 -0400)
136 files changed:
src/librustc/infer/error_reporting/mod.rs
src/librustc/session/config.rs
src/librustc/ty/context.rs
src/librustc_mir/borrow_check/borrow_set.rs
src/librustc_mir/borrow_check/error_reporting.rs
src/librustc_mir/borrow_check/mod.rs
src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs
src/librustc_mir/borrow_check/nll/type_check/mod.rs
src/librustc_mir/dataflow/impls/borrows.rs
src/test/compile-fail/E0501.rs
src/test/compile-fail/borrowck/borrowck-asm.rs
src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs
src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs
src/test/compile-fail/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
src/test/compile-fail/borrowck/borrowck-lend-flow-match.rs
src/test/compile-fail/borrowck/borrowck-match-already-borrowed.rs
src/test/compile-fail/borrowck/borrowck-mut-borrow-linear-errors.rs
src/test/compile-fail/borrowck/borrowck-overloaded-index-ref-index.rs
src/test/compile-fail/borrowck/borrowck-pat-reassign-binding.rs
src/test/compile-fail/borrowck/borrowck-union-borrow.rs
src/test/compile-fail/borrowck/two-phase-activation-sharing-interference.rs
src/test/compile-fail/borrowck/two-phase-allow-access-during-reservation.rs
src/test/compile-fail/borrowck/two-phase-cannot-nest-mut-self-calls.rs
src/test/compile-fail/borrowck/two-phase-nonrecv-autoref.rs
src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference-2.rs
src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference.rs
src/test/compile-fail/borrowck/two-phase-sneaky.rs
src/test/compile-fail/coerce-overloaded-autoderef.rs
src/test/compile-fail/hrtb-identity-fn-borrows.rs
src/test/compile-fail/issue-36082.rs
src/test/compile-fail/mir_check_cast_closure.rs
src/test/compile-fail/mir_check_cast_reify.rs
src/test/compile-fail/mir_check_cast_unsafe_fn.rs
src/test/compile-fail/mir_check_cast_unsize.rs
src/test/compile-fail/mut-pattern-internal-mutability.rs
src/test/compile-fail/nll/loan_ends_mid_block_pair.rs
src/test/compile-fail/nll/loan_ends_mid_block_vec.rs
src/test/compile-fail/nll/reference-carried-through-struct-field.rs
src/test/compile-fail/nll/region-ends-after-if-condition.rs
src/test/compile-fail/nll/return_from_loop.rs
src/test/compile-fail/nll/where_clauses_in_functions.rs
src/test/compile-fail/nll/where_clauses_in_structs.rs
src/test/compile-fail/regions-pattern-typing-issue-19997.rs
src/test/compile-fail/regions-static-bound.rs
src/test/mir-opt/nll/liveness-call-subtlety.rs
src/test/mir-opt/nll/liveness-drop-intra-block.rs
src/test/mir-opt/nll/liveness-interblock.rs
src/test/mir-opt/nll/named-lifetimes-basic.rs
src/test/mir-opt/nll/reborrow-basic.rs
src/test/mir-opt/nll/region-liveness-basic.rs
src/test/mir-opt/nll/region-liveness-two-disjoint-uses.rs
src/test/mir-opt/nll/region-subtyping-basic.rs
src/test/run-pass/borrowck/two-phase-baseline.rs
src/test/run-pass/impl-trait/example-calendar.rs
src/test/ui/borrowck/borrowck-closures-two-mut.rs
src/test/ui/borrowck/borrowck-closures-two-mut.stderr
src/test/ui/borrowck/two-phase-method-receivers.rs
src/test/ui/borrowck/two-phase-multiple-activations.rs
src/test/ui/issue-45697-1.rs
src/test/ui/issue-45697-1.stderr
src/test/ui/issue-45697.rs
src/test/ui/issue-45697.stderr
src/test/ui/issue-46471-1.stderr
src/test/ui/nll/closure-requirements/escape-argument-callee.rs
src/test/ui/nll/closure-requirements/escape-argument-callee.stderr
src/test/ui/nll/closure-requirements/escape-argument.rs
src/test/ui/nll/closure-requirements/escape-upvar-nested.rs
src/test/ui/nll/closure-requirements/escape-upvar-ref.rs
src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs
src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr
src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs
src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr
src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs
src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs
src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr
src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs
src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr
src/test/ui/nll/closure-requirements/propagate-approximated-val.rs
src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr
src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.rs
src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr
src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs
src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr
src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs
src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
src/test/ui/nll/closure-requirements/propagate-from-trait-match.rs
src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr
src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs
src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr
src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs
src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr
src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs
src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr
src/test/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs
src/test/ui/nll/closure-requirements/return-wrong-bound-region.rs
src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
src/test/ui/nll/constant.rs
src/test/ui/nll/drop-may-dangle.rs
src/test/ui/nll/drop-no-may-dangle.rs
src/test/ui/nll/get_default.rs
src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs
src/test/ui/nll/maybe-initialized-drop-uninitialized.rs
src/test/ui/nll/maybe-initialized-drop-with-fragment.rs
src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs
src/test/ui/nll/maybe-initialized-drop.rs
src/test/ui/nll/projection-return.rs
src/test/ui/nll/ty-outlives/impl-trait-captures.rs
src/test/ui/nll/ty-outlives/impl-trait-captures.stderr
src/test/ui/nll/ty-outlives/impl-trait-outlives.rs
src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr
src/test/ui/nll/ty-outlives/projection-implied-bounds.rs
src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr
src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs
src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr
src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs
src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr
src/test/ui/nll/ty-outlives/projection-one-region-closure.rs
src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr
src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs
src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr
src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs
src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs
src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs
src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs
src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs
src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
src/test/ui/nll/ty-outlives/ty-param-fn-body.rs
src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr
src/test/ui/nll/ty-outlives/ty-param-fn.rs
src/test/ui/nll/ty-outlives/ty-param-fn.stderr
src/test/ui/nll/ty-outlives/ty-param-implied-bounds.rs
src/tools/compiletest/src/runtest.rs

index 8d314e251972d140e1b173b931b1b71d306b5a40..254fba095e2363229e5d5d33a612484e6983fec4 100644 (file)
@@ -303,7 +303,7 @@ pub fn report_region_errors(
     ) {
         debug!("report_region_errors(): {} errors to start", errors.len());
 
-        if will_later_be_reported_by_nll && self.tcx.nll() {
+        if will_later_be_reported_by_nll && self.tcx.use_mir() {
             // With `#![feature(nll)]`, we want to present a nice user
             // experience, so don't even mention the errors from the
             // AST checker.
@@ -311,20 +311,20 @@ pub fn report_region_errors(
                 return;
             }
 
-            // But with -Znll, it's nice to have some note for later.
+            // But with nll, it's nice to have some note for later.
             for error in errors {
                 match *error {
                     RegionResolutionError::ConcreteFailure(ref origin, ..)
                     | RegionResolutionError::GenericBoundFailure(ref origin, ..) => {
                         self.tcx
                             .sess
-                            .span_warn(origin.span(), "not reporting region error due to -Znll");
+                            .span_warn(origin.span(), "not reporting region error due to nll");
                     }
 
                     RegionResolutionError::SubSupConflict(ref rvo, ..) => {
                         self.tcx
                             .sess
-                            .span_warn(rvo.span(), "not reporting region error due to -Znll");
+                            .span_warn(rvo.span(), "not reporting region error due to nll");
                     }
                 }
             }
index d309026212bfa1f408667cfe5a6053064553adb1..9c59cdffed3c2110699a813d6f56c048f85029ca 100644 (file)
@@ -1255,8 +1255,6 @@ fn parse_edition(slot: &mut Edition, v: Option<&str>) -> bool {
         useful for profiling / PGO."),
     relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED],
         "choose which RELRO level to use"),
-    nll: bool = (false, parse_bool, [UNTRACKED],
-                 "run the non-lexical lifetimes MIR pass"),
     disable_nll_user_type_assert: bool = (false, parse_bool, [UNTRACKED],
         "disable user provided type assertion in NLL"),
     trans_time_graph: bool = (false, parse_bool, [UNTRACKED],
index a508f33db3f771c0eab854fd3c666cf67ddc6125..c4a34b4101aeb2e78070d31100d875048ecf532e 100644 (file)
@@ -1471,12 +1471,6 @@ pub fn serialize_query_result_cache<E>(self,
         self.on_disk_query_result_cache.serialize(self.global_tcx(), encoder)
     }
 
-    /// If true, we should use NLL-style region checking instead of
-    /// lexical style.
-    pub fn nll(self) -> bool {
-        self.features().nll || self.sess.opts.debugging_opts.nll
-    }
-
     /// If true, we should use the MIR-based borrowck (we may *also* use
     /// the AST-based borrowck).
     pub fn use_mir(self) -> bool {
@@ -1498,7 +1492,7 @@ pub fn borrowck_mode(&self) -> BorrowckMode {
             mode @ BorrowckMode::Compare => mode,
 
             mode @ BorrowckMode::Ast => {
-                if self.nll() {
+                if self.features().nll {
                     BorrowckMode::Mir
                 } else {
                     mode
@@ -1512,8 +1506,6 @@ pub fn borrowck_mode(&self) -> BorrowckMode {
     /// MIR borrowck, but not when NLL is used. They are also consumed
     /// by the validation stuff.
     pub fn emit_end_regions(self) -> bool {
-        // FIXME(#46875) -- we should not emit end regions when NLL is enabled,
-        // but for now we can't stop doing so because it causes false positives
         self.sess.opts.debugging_opts.emit_end_regions ||
             self.sess.opts.debugging_opts.mir_emit_validate > 0 ||
             self.use_mir()
index c2d7d68923dd9aa2588e3cc1c4f431e0af1a60ac..ccfb44a8b58fbf3ab1cda42cb11a82cf5daac592 100644 (file)
 use rustc::mir::traversal;
 use rustc::mir::visit::{PlaceContext, Visitor};
 use rustc::mir::{self, Location, Mir, Place};
-use rustc::ty::{self, Region, RegionKind, TyCtxt};
+use rustc::ty::{Region, TyCtxt};
 use rustc::util::nodemap::{FxHashMap, FxHashSet};
 use rustc_data_structures::indexed_vec::IndexVec;
 use std::fmt;
 use std::hash::Hash;
 use std::ops::Index;
-use syntax_pos::Span;
 
 crate struct BorrowSet<'tcx> {
     /// The fundamental map relating bitvector indexes to the borrows
 
     /// Map from local to all the borrows on that local
     crate local_map: FxHashMap<mir::Local, FxHashSet<BorrowIndex>>,
-
-    /// Maps regions to their corresponding source spans
-    /// Only contains ReScope()s as keys
-    crate region_span_map: FxHashMap<RegionKind, Span>,
 }
 
 impl<'tcx> Index<BorrowIndex> for BorrowSet<'tcx> {
@@ -103,7 +98,6 @@ pub fn build(tcx: TyCtxt<'_, '_, 'tcx>, mir: &Mir<'tcx>) -> Self {
             activation_map: FxHashMap(),
             region_map: FxHashMap(),
             local_map: FxHashMap(),
-            region_span_map: FxHashMap(),
             pending_activations: FxHashMap(),
         };
 
@@ -130,7 +124,6 @@ pub fn build(tcx: TyCtxt<'_, '_, 'tcx>, mir: &Mir<'tcx>) -> Self {
             activation_map: visitor.activation_map,
             region_map: visitor.region_map,
             local_map: visitor.local_map,
-            region_span_map: visitor.region_span_map,
         }
     }
 
@@ -150,7 +143,6 @@ struct GatherBorrows<'a, 'gcx: 'tcx, 'tcx: 'a> {
     activation_map: FxHashMap<Location, Vec<BorrowIndex>>,
     region_map: FxHashMap<Region<'tcx>, FxHashSet<BorrowIndex>>,
     local_map: FxHashMap<mir::Local, FxHashSet<BorrowIndex>>,
-    region_span_map: FxHashMap<RegionKind, Span>,
 
     /// When we encounter a 2-phase borrow statement, it will always
     /// be assigning into a temporary TEMP:
@@ -276,10 +268,6 @@ fn visit_statement(
         statement: &mir::Statement<'tcx>,
         location: Location,
     ) {
-        if let mir::StatementKind::EndRegion(region_scope) = statement.kind {
-            self.region_span_map
-                .insert(ty::ReScope(region_scope), statement.source_info.span);
-        }
         return self.super_statement(block, statement, location);
     }
 }
index 340ff5e17876798c814a77ab70f8566fb05feebc..3dc5a7a84900cb280376e1933ddb24b5413321fd 100644 (file)
@@ -263,7 +263,6 @@ pub(super) fn report_conflicting_borrow(
         (place, span): (&Place<'tcx>, Span),
         gen_borrow_kind: BorrowKind,
         issued_borrow: &BorrowData<'tcx>,
-        end_issued_loan_span: Option<Span>,
     ) {
         let issued_span = self.retrieve_borrow_span(issued_borrow);
 
@@ -297,7 +296,7 @@ pub(super) fn report_conflicting_borrow(
                     "it",
                     rgt,
                     "",
-                    end_issued_loan_span,
+                    None,
                     Origin::Mir,
                 )
             }
@@ -309,7 +308,7 @@ pub(super) fn report_conflicting_borrow(
                     "",
                     issued_span,
                     "",
-                    end_issued_loan_span,
+                    None,
                     Origin::Mir,
                 )
             }
@@ -319,7 +318,7 @@ pub(super) fn report_conflicting_borrow(
                     span,
                     &desc_place,
                     issued_span,
-                    end_issued_loan_span,
+                    None,
                     Origin::Mir,
                 )
             }
@@ -331,7 +330,7 @@ pub(super) fn report_conflicting_borrow(
                 issued_span,
                 "it",
                 "",
-                end_issued_loan_span,
+                None,
                 Origin::Mir,
             ),
 
@@ -343,7 +342,7 @@ pub(super) fn report_conflicting_borrow(
                     lft,
                     issued_span,
                     "",
-                    end_issued_loan_span,
+                    None,
                     Origin::Mir,
                 )
             }
@@ -356,7 +355,7 @@ pub(super) fn report_conflicting_borrow(
                     lft,
                     issued_span,
                     "",
-                    end_issued_loan_span,
+                    None,
                     Origin::Mir,
                 )
             }
@@ -392,7 +391,6 @@ pub(super) fn report_borrowed_value_does_not_live_long_enough(
         borrow: &BorrowData<'tcx>,
         drop_span: Span,
     ) {
-        let end_span = self.opt_region_end_span(&borrow.region);
         let scope_tree = self.tcx.region_scope_tree(self.mir_def_id);
         let root_place = self.prefixes(&borrow.borrowed_place, PrefixSet::All)
             .last()
@@ -427,7 +425,6 @@ pub(super) fn report_borrowed_value_does_not_live_long_enough(
                     drop_span,
                     borrow_span,
                     proper_span,
-                    end_span,
                 );
             }
             (RegionKind::ReScope(_), None) => {
@@ -438,7 +435,6 @@ pub(super) fn report_borrowed_value_does_not_live_long_enough(
                     drop_span,
                     borrow_span,
                     proper_span,
-                    end_span,
                 );
             }
             (RegionKind::ReEarlyBound(_), Some(name))
@@ -454,7 +450,6 @@ pub(super) fn report_borrowed_value_does_not_live_long_enough(
                     drop_span,
                     borrow_span,
                     proper_span,
-                    end_span,
                 );
             }
             (RegionKind::ReEarlyBound(_), None)
@@ -469,7 +464,6 @@ pub(super) fn report_borrowed_value_does_not_live_long_enough(
                     drop_span,
                     borrow_span,
                     proper_span,
-                    end_span,
                 );
             }
             (RegionKind::ReLateBound(_, _), _)
@@ -491,7 +485,6 @@ fn report_scoped_local_value_does_not_live_long_enough(
         drop_span: Span,
         borrow_span: Span,
         _proper_span: Span,
-        end_span: Option<Span>,
     ) {
         let tcx = self.tcx;
         let mut err =
@@ -501,9 +494,6 @@ fn report_scoped_local_value_does_not_live_long_enough(
             drop_span,
             format!("`{}` dropped here while still borrowed", name),
         );
-        if let Some(end) = end_span {
-            err.span_label(end, "borrowed value needs to live until here");
-        }
         self.explain_why_borrow_contains_point(context, borrow, &mut err);
         err.emit();
     }
@@ -516,7 +506,6 @@ fn report_scoped_temporary_value_does_not_live_long_enough(
         drop_span: Span,
         _borrow_span: Span,
         proper_span: Span,
-        end_span: Option<Span>,
     ) {
         let tcx = self.tcx;
         let mut err =
@@ -527,9 +516,6 @@ fn report_scoped_temporary_value_does_not_live_long_enough(
             "temporary value dropped here while still borrowed",
         );
         err.note("consider using a `let` binding to increase its lifetime");
-        if let Some(end) = end_span {
-            err.span_label(end, "temporary value needs to live until here");
-        }
         self.explain_why_borrow_contains_point(context, borrow, &mut err);
         err.emit();
     }
@@ -543,7 +529,6 @@ fn report_unscoped_local_value_does_not_live_long_enough(
         drop_span: Span,
         borrow_span: Span,
         _proper_span: Span,
-        _end_span: Option<Span>,
     ) {
         debug!(
             "report_unscoped_local_value_does_not_live_long_enough(\
@@ -558,16 +543,6 @@ fn report_unscoped_local_value_does_not_live_long_enough(
         err.span_label(borrow_span, "borrowed value does not live long enough");
         err.span_label(drop_span, "borrowed value only lives until here");
 
-        if !tcx.nll() {
-            tcx.note_and_explain_region(
-                scope_tree,
-                &mut err,
-                "borrowed value must be valid for ",
-                borrow.region,
-                "...",
-            );
-        }
-
         self.explain_why_borrow_contains_point(context, borrow, &mut err);
         err.emit();
     }
@@ -580,7 +555,6 @@ fn report_unscoped_temporary_value_does_not_live_long_enough(
         drop_span: Span,
         _borrow_span: Span,
         proper_span: Span,
-        _end_span: Option<Span>,
     ) {
         debug!(
             "report_unscoped_temporary_value_does_not_live_long_enough(\
@@ -595,16 +569,6 @@ fn report_unscoped_temporary_value_does_not_live_long_enough(
         err.span_label(proper_span, "temporary value does not live long enough");
         err.span_label(drop_span, "temporary value only lives until here");
 
-        if !tcx.nll() {
-            tcx.note_and_explain_region(
-                scope_tree,
-                &mut err,
-                "borrowed value must be valid for ",
-                borrow.region,
-                "...",
-            );
-        }
-
         self.explain_why_borrow_contains_point(context, borrow, &mut err);
         err.emit();
     }
index 5b4c66bd65c176a10ed276fd4e9bc82e49531cb8..22550319a1c637c2acfec73c18c5f7a28a0e256d 100644 (file)
@@ -98,19 +98,13 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
         .as_local_node_id(def_id)
         .expect("do_mir_borrowck: non-local DefId");
 
-    // Make our own copy of the MIR. This copy will be modified (in place) to
-    // contain non-lexical lifetimes. It will have a lifetime tied
-    // to the inference context.
+    // Replace all regions with fresh inference variables. This
+    // requires first making our own copy of the MIR. This copy will
+    // be modified (in place) to contain non-lexical lifetimes. It
+    // will have a lifetime tied to the inference context.
     let mut mir: Mir<'tcx> = input_mir.clone();
-    let free_regions = if !tcx.nll() {
-        None
-    } else {
-        let mir = &mut mir;
-
-        // Replace all regions with fresh inference variables.
-        Some(nll::replace_regions_in_mir(infcx, def_id, param_env, mir))
-    };
-    let mir = &mir;
+    let free_regions = nll::replace_regions_in_mir(infcx, def_id, param_env, &mut mir);
+    let mir = &mir; // no further changes
 
     let move_data: MoveData<'tcx> = match MoveData::gather_moves(mir, tcx) {
         Ok(move_data) => move_data,
@@ -195,22 +189,17 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
     let borrow_set = Rc::new(BorrowSet::build(tcx, mir));
 
     // If we are in non-lexical mode, compute the non-lexical lifetimes.
-    let (opt_regioncx, opt_closure_req) = if let Some(free_regions) = free_regions {
-        let (regioncx, opt_closure_req) = nll::compute_regions(
-            infcx,
-            def_id,
-            free_regions,
-            mir,
-            param_env,
-            &mut flow_inits,
-            &mdpe.move_data,
-            &borrow_set,
-        );
-        (Some(Rc::new(regioncx)), opt_closure_req)
-    } else {
-        assert!(!tcx.nll());
-        (None, None)
-    };
+    let (regioncx, opt_closure_req) = nll::compute_regions(
+        infcx,
+        def_id,
+        free_regions,
+        mir,
+        param_env,
+        &mut flow_inits,
+        &mdpe.move_data,
+        &borrow_set,
+    );
+    let regioncx = Rc::new(regioncx);
     let flow_inits = flow_inits; // remove mut
 
     let flow_borrows = FlowAtLocation::new(do_dataflow(
@@ -219,7 +208,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
         id,
         &attributes,
         &dead_unwinds,
-        Borrows::new(tcx, mir, opt_regioncx.clone(), def_id, body_id, &borrow_set),
+        Borrows::new(tcx, mir, regioncx.clone(), def_id, body_id, &borrow_set),
         |rs, i| DebugFormatted::new(&rs.location(i)),
     ));
 
@@ -247,7 +236,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
         access_place_error_reported: FxHashSet(),
         reservation_error_reported: FxHashSet(),
         moved_error_reported: FxHashSet(),
-        nonlexical_regioncx: opt_regioncx,
+        nonlexical_regioncx: regioncx,
         nonlexical_cause_info: None,
         borrow_set,
         dominators,
@@ -301,7 +290,7 @@ pub struct MirBorrowckCtxt<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
     /// Non-lexical region inference context, if NLL is enabled.  This
     /// contains the results from region inference and lets us e.g.
     /// find out which CFG points are contained in each borrow region.
-    nonlexical_regioncx: Option<Rc<RegionInferenceContext<'tcx>>>,
+    nonlexical_regioncx: Rc<RegionInferenceContext<'tcx>>,
     nonlexical_cause_info: Option<RegionCausalInfo>,
 
     /// The set of borrows extracted from the MIR
@@ -897,14 +886,12 @@ fn check_access_for_conflict(
                             this.report_use_while_mutably_borrowed(context, place_span, borrow)
                         }
                         ReadKind::Borrow(bk) => {
-                            let end_issued_loan_span = this.opt_region_end_span(&borrow.region);
                             error_reported = true;
                             this.report_conflicting_borrow(
                                 context,
                                 place_span,
                                 bk,
                                 &borrow,
-                                end_issued_loan_span,
                             )
                         }
                     }
@@ -936,15 +923,12 @@ fn check_access_for_conflict(
 
                     match kind {
                         WriteKind::MutableBorrow(bk) => {
-                            let end_issued_loan_span = this.opt_region_end_span(&borrow.region);
-
                             error_reported = true;
                             this.report_conflicting_borrow(
                                 context,
                                 place_span,
                                 bk,
                                 &borrow,
-                                end_issued_loan_span,
                             )
                         }
                         WriteKind::StorageDeadOrDrop => {
@@ -1832,22 +1816,6 @@ fn is_upvar_field_projection(&self, place: &Place<'tcx>) -> Option<Field> {
             _ => None,
         }
     }
-
-    /// Returns the span for the "end point" given region. This will
-    /// return `None` if NLL is enabled, since that concept has no
-    /// meaning there.  Otherwise, return region span if it exists and
-    /// span for end of the function if it doesn't exist.
-    pub(crate) fn opt_region_end_span(&self, region: &ty::Region<'tcx>) -> Option<Span> {
-        match self.nonlexical_regioncx {
-            Some(_) => None,
-            None => {
-                match self.borrow_set.region_span_map.get(region) {
-                    Some(span) => Some(self.tcx.sess.codemap().end_point(*span)),
-                    None => Some(self.tcx.sess.codemap().end_point(self.mir.span))
-                }
-            }
-        }
-    }
 }
 
 #[derive(Copy, Clone, PartialEq, Eq, Debug)]
index b12beb524e20d35919533159ef167d7905a60db6..d5e11a312ec26fb763f3be5dc6f8e9c5162131be 100644 (file)
@@ -29,82 +29,81 @@ pub(in borrow_check) fn explain_why_borrow_contains_point(
         borrow: &BorrowData<'tcx>,
         err: &mut DiagnosticBuilder<'_>,
     ) {
-        if let Some(regioncx) = &self.nonlexical_regioncx {
-            let mir = self.mir;
+        let regioncx = &&self.nonlexical_regioncx;
+        let mir = self.mir;
 
-            if self.nonlexical_cause_info.is_none() {
-                self.nonlexical_cause_info = Some(regioncx.compute_causal_info(mir));
-            }
+        if self.nonlexical_cause_info.is_none() {
+            self.nonlexical_cause_info = Some(regioncx.compute_causal_info(mir));
+        }
+
+        let cause_info = self.nonlexical_cause_info.as_ref().unwrap();
+        if let Some(cause) = cause_info.why_region_contains_point(borrow.region, context.loc) {
+            match *cause.root_cause() {
+                Cause::LiveVar(local, location) => {
+                    match find_regular_use(mir, regioncx, borrow, location, local) {
+                        Some(p) => {
+                            err.span_label(
+                                mir.source_info(p).span,
+                                format!("borrow later used here"),
+                            );
+                        }
+
+                        None => {
+                            span_bug!(
+                                mir.source_info(context.loc).span,
+                                "Cause should end in a LiveVar"
+                            );
+                        }
+                    }
+                }
 
-            let cause_info = self.nonlexical_cause_info.as_ref().unwrap();
-            if let Some(cause) = cause_info.why_region_contains_point(borrow.region, context.loc) {
-                match *cause.root_cause() {
-                    Cause::LiveVar(local, location) => {
-                        match find_regular_use(mir, regioncx, borrow, location, local) {
-                            Some(p) => {
+                Cause::DropVar(local, location) => {
+                    match find_drop_use(mir, regioncx, borrow, location, local) {
+                        Some(p) => match &mir.local_decls[local].name {
+                            Some(local_name) => {
                                 err.span_label(
                                     mir.source_info(p).span,
-                                    format!("borrow later used here"),
+                                    format!(
+                                        "borrow later used here, when `{}` is dropped",
+                                        local_name
+                                    ),
                                 );
                             }
-
                             None => {
-                                span_bug!(
-                                    mir.source_info(context.loc).span,
-                                    "Cause should end in a LiveVar"
+                                err.span_label(
+                                    mir.local_decls[local].source_info.span,
+                                    "borrow may end up in a temporary, created here",
                                 );
-                            }
-                        }
-                    }
 
-                    Cause::DropVar(local, location) => {
-                        match find_drop_use(mir, regioncx, borrow, location, local) {
-                            Some(p) => match &mir.local_decls[local].name {
-                                Some(local_name) => {
-                                    err.span_label(
-                                        mir.source_info(p).span,
-                                        format!(
-                                            "borrow later used here, when `{}` is dropped",
-                                            local_name
-                                        ),
-                                    );
-                                }
-                                None => {
-                                    err.span_label(
-                                        mir.local_decls[local].source_info.span,
-                                        "borrow may end up in a temporary, created here",
-                                    );
-
-                                    err.span_label(
-                                        mir.source_info(p).span,
-                                        "temporary later dropped here, \
-                                         potentially using the reference",
-                                    );
-                                }
-                            },
-
-                            None => {
-                                span_bug!(
-                                    mir.source_info(context.loc).span,
-                                    "Cause should end in a DropVar"
+                                err.span_label(
+                                    mir.source_info(p).span,
+                                    "temporary later dropped here, \
+                                     potentially using the reference",
                                 );
                             }
-                        }
-                    }
+                        },
 
-                    Cause::UniversalRegion(region_vid) => {
-                        if let Some(region) = regioncx.to_error_region(region_vid) {
-                            self.tcx.note_and_explain_free_region(
-                                err,
-                                "borrowed value must be valid for ",
-                                region,
-                                "...",
+                        None => {
+                            span_bug!(
+                                mir.source_info(context.loc).span,
+                                "Cause should end in a DropVar"
                             );
                         }
                     }
+                }
 
-                    _ => {}
+                Cause::UniversalRegion(region_vid) => {
+                    if let Some(region) = regioncx.to_error_region(region_vid) {
+                        self.tcx.note_and_explain_free_region(
+                            err,
+                            "borrowed value must be valid for ",
+                            region,
+                            "...",
+                        );
+                    }
                 }
+
+                _ => {}
             }
         }
     }
index 544cb5eefc8868a86ba3a2adf9e33d56d7647e7e..bdcff1a2d819cb3c2e8a39a1bed41a2e0767456d 100644 (file)
@@ -1596,7 +1596,7 @@ fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, src: MirSource, mir: &
 
         // When NLL is enabled, the borrow checker runs the typeck
         // itself, so we don't need this MIR pass anymore.
-        if tcx.nll() {
+        if tcx.use_mir() {
             return;
         }
 
index 55c38dc89f6363f1ef8cff0d7df200670e3efb13..a21691813a4d4bdd8f8edaa579da1430bfef6346 100644 (file)
@@ -48,14 +48,14 @@ pub struct Borrows<'a, 'gcx: 'tcx, 'tcx: 'a> {
     borrow_set: Rc<BorrowSet<'tcx>>,
 
     /// NLL region inference context with which NLL queries should be resolved
-    nonlexical_regioncx: Option<Rc<RegionInferenceContext<'tcx>>>,
+    nonlexical_regioncx: Rc<RegionInferenceContext<'tcx>>,
 }
 
 impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> {
     crate fn new(
         tcx: TyCtxt<'a, 'gcx, 'tcx>,
         mir: &'a Mir<'tcx>,
-        nonlexical_regioncx: Option<Rc<RegionInferenceContext<'tcx>>>,
+        nonlexical_regioncx: Rc<RegionInferenceContext<'tcx>>,
         def_id: DefId,
         body_id: Option<hir::BodyId>,
         borrow_set: &Rc<BorrowSet<'tcx>>
@@ -89,23 +89,23 @@ pub fn location(&self, idx: BorrowIndex) -> &Location {
     fn kill_loans_out_of_scope_at_location(&self,
                                            sets: &mut BlockSets<BorrowIndex>,
                                            location: Location) {
-        if let Some(ref regioncx) = self.nonlexical_regioncx {
-            // NOTE: The state associated with a given `location`
-            // reflects the dataflow on entry to the statement. If it
-            // does not contain `borrow_region`, then then that means
-            // that the statement at `location` kills the borrow.
-            //
-            // We are careful always to call this function *before* we
-            // set up the gen-bits for the statement or
-            // termanator. That way, if the effect of the statement or
-            // terminator *does* introduce a new loan of the same
-            // region, then setting that gen-bit will override any
-            // potential kill introduced here.
-            for (borrow_index, borrow_data) in self.borrow_set.borrows.iter_enumerated() {
-                let borrow_region = borrow_data.region.to_region_vid();
-                if !regioncx.region_contains_point(borrow_region, location) {
-                    sets.kill(&borrow_index);
-                }
+        let regioncx = &self.nonlexical_regioncx;
+
+        // NOTE: The state associated with a given `location`
+        // reflects the dataflow on entry to the statement. If it
+        // does not contain `borrow_region`, then then that means
+        // that the statement at `location` kills the borrow.
+        //
+        // We are careful always to call this function *before* we
+        // set up the gen-bits for the statement or
+        // termanator. That way, if the effect of the statement or
+        // terminator *does* introduce a new loan of the same
+        // region, then setting that gen-bit will override any
+        // potential kill introduced here.
+        for (borrow_index, borrow_data) in self.borrow_set.borrows.iter_enumerated() {
+            let borrow_region = borrow_data.region.to_region_vid();
+            if !regioncx.region_contains_point(borrow_region, location) {
+                sets.kill(&borrow_index);
             }
         }
     }
@@ -153,18 +153,7 @@ fn statement_effect(&self, sets: &mut BlockSets<BorrowIndex>, location: Location
         self.kill_loans_out_of_scope_at_location(sets, location);
 
         match stmt.kind {
-            // EndRegion kills any borrows (reservations and active borrows both)
-            mir::StatementKind::EndRegion(region_scope) => {
-                if let Some(borrow_indexes) =
-                    self.borrow_set.region_map.get(&ReScope(region_scope))
-                {
-                    assert!(self.nonlexical_regioncx.is_none());
-                    for idx in borrow_indexes {
-                        sets.kill(idx);
-                    }
-                } else {
-                    // (if there is no entry, then there are no borrows to be tracked)
-                }
+            mir::StatementKind::EndRegion(_) => {
             }
 
             mir::StatementKind::Assign(ref lhs, ref rhs) => {
index f7e246e8f0f41383b2e9186f3acffec03450de4b..5643e1ef09146eb1fe6b4daae607938d6c3797b1 100644 (file)
@@ -26,10 +26,12 @@ fn foo(a: &mut i32) {
         inside_closure(a)
     };
     outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
-                         //[mir]~^ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
+    //[mir]~^ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
 
     outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
-                         //[mir]~^ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
+    //[mir]~^ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
+
+    drop(bar);
 }
 
 fn main() {
index 9ad3a8f9fc8671e072a93e06d9fb77ccafae32f9..0b230be85ad97c2ab68d97220eb720159c6172d2 100644 (file)
@@ -14,7 +14,7 @@
 // ignore-sparc
 
 // revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir -Z nll
+//[mir]compile-flags: -Z borrowck=mir
 
 #![feature(asm)]
 
index f498d8d500e649e3562905495320f230324cb3fd..9057ba0790712f36ec808332ab3523acacdcd7c4 100644 (file)
@@ -29,7 +29,8 @@ fn a() {
     let mut x = 3;
     let c1 = || x = 4;
     let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
-                       //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+    //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+    drop(c1);
 }
 
 fn b() {
@@ -37,6 +38,7 @@ fn b() {
     let c1 = || set(&mut x);
     let c2 = || get(&x); //[ast]~ ERROR cannot borrow `x`
                          //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+    drop(c1);
 }
 
 fn c() {
@@ -44,6 +46,7 @@ fn c() {
     let c1 = || set(&mut x);
     let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
                        //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+    drop(c1);
 }
 
 fn d() {
@@ -51,6 +54,7 @@ fn d() {
     let c2 = || x * 5;
     x = 5; //[ast]~ ERROR cannot assign
            //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+    drop(c2);
 }
 
 fn e() {
@@ -58,6 +62,7 @@ fn e() {
     let c1 = || get(&x);
     x = 5; //[ast]~ ERROR cannot assign
            //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+    drop(c1);
 }
 
 fn f() {
@@ -65,6 +70,7 @@ fn f() {
     let c1 = || get(&*x);
     *x = 5; //[ast]~ ERROR cannot assign to `*x`
             //[mir]~^ ERROR cannot assign to `*x` because it is borrowed
+    drop(c1);
 }
 
 fn g() {
@@ -76,6 +82,7 @@ struct Foo {
     let c1 = || get(&*x.f);
     *x.f = 5; //[ast]~ ERROR cannot assign to `*x.f`
               //[mir]~^ ERROR cannot assign to `*x.f` because it is borrowed
+    drop(c1);
 }
 
 fn h() {
@@ -87,6 +94,7 @@ struct Foo {
     let c1 = || get(&*x.f);
     let c2 = || *x.f = 5; //[ast]~ ERROR cannot borrow `x` as mutable
                           //[mir]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable
+    drop(c1);
 }
 
 fn main() {
index fa475949b36b0e65612e92e4290e4f0686f948fc..3a7e4a13740d070ab1b4afbba2bf2a7283f52968 100644 (file)
@@ -49,83 +49,93 @@ fn main() {
     // Local and field from struct
     {
         let mut f = Foo { x: 22 };
-        let _x = f.x();
+        let x = f.x();
         f.x; //[ast]~ ERROR cannot use `f.x` because it was mutably borrowed
-             //[mir]~^ ERROR cannot use `f.x` because it was mutably borrowed
+        //[mir]~^ ERROR cannot use `f.x` because it was mutably borrowed
+        drop(x);
     }
     // Local and field from tuple-struct
     {
         let mut g = Bar(22);
-        let _0 = g.x();
+        let x = g.x();
         g.0; //[ast]~ ERROR cannot use `g.0` because it was mutably borrowed
              //[mir]~^ ERROR cannot use `g.0` because it was mutably borrowed
+        drop(x);
     }
     // Local and field from tuple
     {
         let mut h = (22, 23);
-        let _0 = &mut h.0;
+        let x = &mut h.0;
         h.0; //[ast]~ ERROR cannot use `h.0` because it was mutably borrowed
              //[mir]~^ ERROR cannot use `h.0` because it was mutably borrowed
+        drop(x);
     }
     // Local and field from enum
     {
         let mut e = Baz::X(2);
-        let _e0 = e.x();
+        let x = e.x();
         match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
             Baz::X(value) => value
             //[ast]~^ ERROR cannot use `e.0` because it was mutably borrowed
             //[mir]~^^ ERROR cannot use `e.0` because it was mutably borrowed
         };
+        drop(x);
     }
     // Local and field from union
     unsafe {
         let mut u = U { b: 0 };
-        let _ra = &mut u.a;
+        let x = &mut u.a;
         u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
              //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed
+        drop(x);
     }
     // Deref and field from struct
     {
         let mut f = Box::new(Foo { x: 22 });
-        let _x = f.x();
+        let x = f.x();
         f.x; //[ast]~ ERROR cannot use `f.x` because it was mutably borrowed
              //[mir]~^ ERROR cannot use `f.x` because it was mutably borrowed
+        drop(x);
     }
     // Deref and field from tuple-struct
     {
         let mut g = Box::new(Bar(22));
-        let _0 = g.x();
+        let x = g.x();
         g.0; //[ast]~ ERROR cannot use `g.0` because it was mutably borrowed
              //[mir]~^ ERROR cannot use `g.0` because it was mutably borrowed
+        drop(x);
     }
     // Deref and field from tuple
     {
         let mut h = Box::new((22, 23));
-        let _0 = &mut h.0;
+        let x = &mut h.0;
         h.0; //[ast]~ ERROR cannot use `h.0` because it was mutably borrowed
              //[mir]~^ ERROR cannot use `h.0` because it was mutably borrowed
+        drop(x);
     }
     // Deref and field from enum
     {
         let mut e = Box::new(Baz::X(3));
-        let _e0 = e.x();
+        let x = e.x();
         match *e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed
             Baz::X(value) => value
             //[ast]~^ ERROR cannot use `e.0` because it was mutably borrowed
             //[mir]~^^ ERROR cannot use `e.0` because it was mutably borrowed
         };
+        drop(x);
     }
     // Deref and field from union
     unsafe {
         let mut u = Box::new(U { b: 0 });
-        let _ra = &mut u.a;
+        let x = &mut u.a;
         u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
              //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed
+        drop(x);
     }
     // Constant index
     {
         let mut v = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
-        let _v = &mut v;
+        let x = &mut v;
         match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
             &[x, _, .., _, _] => println!("{}", x),
                 //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
@@ -150,11 +160,12 @@ fn main() {
                 //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
                             _ => panic!("other case"),
         }
+        drop(x);
     }
     // Subslices
     {
         let mut v = &[1, 2, 3, 4, 5];
-        let _v = &mut v;
+        let x = &mut v;
         match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
             &[x..] => println!("{:?}", x),
                 //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
@@ -179,13 +190,14 @@ fn main() {
                 //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
             _ => panic!("other case"),
         }
+        drop(x);
     }
     // Downcasted field
     {
         enum E<X> { A(X), B { x: X } }
 
         let mut e = E::A(3);
-        let _e = &mut e;
+        let x = &mut e;
         match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
             E::A(ref ax) =>
                 //[ast]~^ ERROR cannot borrow `e.0` as immutable because `e` is also borrowed as mutable
@@ -197,13 +209,14 @@ enum E<X> { A(X), B { x: X } }
                 //[mir]~^^ ERROR cannot borrow `e.x` as immutable because it is also borrowed as mutable
                 println!("e.bx: {:?}", bx),
         }
+        drop(x);
     }
     // Field in field
     {
         struct F { x: u32, y: u32 };
         struct S { x: F, y: (u32, u32), };
         let mut s = S { x: F { x: 1, y: 2}, y: (999, 998) };
-        let _s = &mut s;
+        let x = &mut s;
         match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
             S  { y: (ref y0, _), .. } =>
                 //[ast]~^ ERROR cannot borrow `s.y.0` as immutable because `s` is also borrowed as mutable
@@ -218,6 +231,7 @@ enum E<X> { A(X), B { x: X } }
                 println!("x0: {:?}", x0),
             _ => panic!("other case"),
         }
+        drop(x);
     }
     // Field of ref
     {
@@ -231,6 +245,7 @@ fn bump<'a>(mut block: &mut Block<'a>) {
             let p: &'a u8 = &*block.current;
             //[mir]~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable
             // No errors in AST because of issue rust#38899
+            drop(x);
         }
     }
     // Field of ptr
@@ -245,29 +260,32 @@ unsafe fn bump2(mut block: *mut Block2) {
             let p : *const u8 = &*(*block).current;
             //[mir]~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable
             // No errors in AST because of issue rust#38899
+            drop(x);
         }
     }
     // Field of index
     {
         struct F {x: u32, y: u32};
         let mut v = &[F{x: 1, y: 2}, F{x: 3, y: 4}];
-        let _v = &mut v;
+        let x = &mut v;
         v[0].y;
         //[ast]~^ ERROR cannot use `v[..].y` because it was mutably borrowed
         //[mir]~^^ ERROR cannot use `v[..].y` because it was mutably borrowed
         //[mir]~| ERROR cannot use `*v` because it was mutably borrowed
+        drop(x);
     }
     // Field of constant index
     {
         struct F {x: u32, y: u32};
         let mut v = &[F{x: 1, y: 2}, F{x: 3, y: 4}];
-        let _v = &mut v;
+        let x = &mut v;
         match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
             &[_, F {x: ref xf, ..}] => println!("{}", xf),
             //[mir]~^ ERROR cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
             // No errors in AST
             _ => panic!("other case")
         }
+        drop(x);
     }
     // Field from upvar
     {
@@ -281,13 +299,15 @@ unsafe fn bump2(mut block: *mut Block2) {
     }
     // Field from upvar nested
     {
+        // FIXME(#49824) -- the free region error below should probably not be there
         let mut x = 0;
            || {
-               || {
-                let y = &mut x;
-                &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time
-                        //[mir]~^ ERROR cannot borrow `x` as mutable more than once at a time
-                *y = 1;
+               || { //[mir]~ ERROR free region `` does not outlive
+                   let y = &mut x;
+                   &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time
+                   //[mir]~^ ERROR cannot borrow `x` as mutable more than once at a time
+                   *y = 1;
+                   drop(y);
                 }
            };
     }
index f09a0c7414ba901267846ed523ed10651afa8557..6f0e0f43f60885bc17c2d2c01b80b7c2ce63a3be 100644 (file)
 
 fn main() {
     let mut _a = 3;
-    let _b = &mut _a;
+    let b = &mut _a;
     {
-        let _c = &*_b;
+        let c = &*b;
         _a = 4; //[ast]~ ERROR cannot assign to `_a`
-                //[mir]~^ ERROR cannot assign to `_a` because it is borrowed
+        //[mir]~^ ERROR cannot assign to `_a` because it is borrowed
+        drop(c);
     }
+    drop(b);
 }
index 2fe764568bc82999e2b518ba87e0051b46812931..f2f3e7914227c788619e6122d3058227ee978e7d 100644 (file)
@@ -24,9 +24,10 @@ fn separate_arms() {
             // fact no outstanding loan of x!
             x = Some(0);
         }
-        Some(ref __isize) => {
+        Some(ref r) => {
             x = Some(1); //[ast]~ ERROR cannot assign
-                         //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+            //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+            drop(r);
         }
     }
     x.clone(); // just to prevent liveness warnings
index 3e57ac0ca1910a11996afa2a0b04ca796e2456a3..c2136e62a7b228afb0993055d0914953ffec9f25 100644 (file)
@@ -25,16 +25,18 @@ fn match_enum() {
         Foo::A(x) => x //[ast]~ ERROR [E0503]
                        //[mir]~^ ERROR [E0503]
     };
+    drop(p);
 }
 
 
 fn main() {
     let mut x = 1;
-    let _x = &mut x;
+    let r = &mut x;
     let _ = match x { //[mir]~ ERROR [E0503]
         x => x + 1, //[ast]~ ERROR [E0503]
                     //[mir]~^ ERROR [E0503]
         y => y + 2, //[ast]~ ERROR [E0503]
                     //[mir]~^ ERROR [E0503]
     };
+    drop(r);
 }
index 63bb04a0e4c3afd38716b3e7de834bbe298a963f..7b0a71815a5f065de4f43d43110ec81790642896 100644 (file)
 
 fn main() {
     let mut x = 1;
-    let mut addr;
+    let mut addr = vec![];
     loop {
         match 1 {
-            1 => { addr = &mut x; } //[ast]~ ERROR [E0499]
+            1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
             //[mir]~^ ERROR [E0499]
-            2 => { addr = &mut x; } //[ast]~ ERROR [E0499]
+            2 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
             //[mir]~^ ERROR [E0499]
-            _ => { addr = &mut x; } //[ast]~ ERROR [E0499]
+            _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
             //[mir]~^ ERROR [E0499]
         }
     }
index 3a4c22eb1395a0f6bfb915d48a804d0543aea9a1..109fe3d1128e1990b186e36158e679b864db127d 100644 (file)
@@ -71,4 +71,5 @@ fn main() {
     s[2] = 20;
     //[ast]~^ ERROR cannot assign to immutable indexed content
     //[mir]~^^ ERROR cannot assign to immutable item
+    drop(rs);
 }
index 0f3a841821080a9748b3a12abde46e039108cde3..d917a0abb88d089a1cd20eafa558562dbe3a4dba 100644 (file)
@@ -21,7 +21,8 @@ fn main() {
       Some(ref i) => {
           // But on this branch, `i` is an outstanding borrow
           x = Some(*i+1); //[ast]~ ERROR cannot assign to `x`
-                          //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+          //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+          drop(i);
       }
     }
     x.clone(); // just to prevent liveness warnings
index 0241b3870c7e64554f8a692b5c4bc8722dc60fc5..97193bd0191237ffe735c3f904257746f4f09abe 100644 (file)
@@ -25,82 +25,98 @@ fn main() {
         {
             let ra = &u.a;
             let ra2 = &u.a; // OK
+            drop(ra);
         }
         {
             let ra = &u.a;
             let a = u.a; // OK
+            drop(ra);
         }
         {
             let ra = &u.a;
             let rma = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
                                 //[mir]~^ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
+            drop(ra);
         }
         {
             let ra = &u.a;
             u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
                      //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed
+            drop(ra);
         }
         // Imm borrow, other field
         {
             let ra = &u.a;
             let rb = &u.b; // OK
+            drop(ra);
         }
         {
             let ra = &u.a;
             let b = u.b; // OK
+            drop(ra);
         }
         {
             let ra = &u.a;
             let rmb = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`)
                                 //[mir]~^ ERROR cannot borrow `u.b` as mutable because it is also borrowed as immutable
+            drop(ra);
         }
         {
             let ra = &u.a;
             u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed
                      //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed
+            drop(ra);
         }
         // Mut borrow, same field
         {
             let rma = &mut u.a;
             let ra = &u.a; //[ast]~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
                          //[mir]~^ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
+            drop(rma);
         }
         {
             let ra = &mut u.a;
             let a = u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
                          //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed
+            drop(ra);
         }
         {
             let rma = &mut u.a;
             let rma2 = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable more than once at a time
                                  //[mir]~^ ERROR cannot borrow `u.a` as mutable more than once at a time
+            drop(rma);
         }
         {
             let rma = &mut u.a;
             u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
                      //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed
+            drop(rma);
         }
         // Mut borrow, other field
         {
             let rma = &mut u.a;
             let rb = &u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`)
                            //[mir]~^ ERROR cannot borrow `u.b` as immutable because it is also borrowed as mutable
+            drop(rma);
         }
         {
             let ra = &mut u.a;
             let b = u.b; //[ast]~ ERROR cannot use `u.b` because it was mutably borrowed
                          //[mir]~^ ERROR cannot use `u.b` because it was mutably borrowed
 
+            drop(ra);
         }
         {
             let rma = &mut u.a;
             let rmb2 = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time
                                  //[mir]~^ ERROR cannot borrow `u.b` as mutable more than once at a time
+            drop(rma);
         }
         {
             let rma = &mut u.a;
             u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed
                      //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed
+            drop(rma);
         }
     }
 }
index 90933c6b31fa868b8ce7bffe37ce552130639be9..77b237e34f2b7d0bc7c3810d5b33b67a12d83304 100644 (file)
 // revisions: nll_target
 
 // The following revisions are disabled due to missing support from two-phase beyond autorefs
-//[lxl_beyond] compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z two-phase-beyond-autoref
-//[nll_beyond] compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z two-phase-beyond-autoref -Z nll
+//[nll_beyond] compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z two-phase-beyond-autoref
 
-//[nll_target] compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
+//[nll_target] compile-flags: -Z borrowck=mir -Z two-phase-borrows
 
 // This is an important corner case pointed out by Niko: one is
 // allowed to initiate a shared borrow during a reservation, but it
index d2f4154433ab152b4c9a8eac7657d97233162788..5deabf9376482ccdcf5c1ece14710ae1c83f8f24 100644 (file)
 // revisions: nll_target
 
 // The following revisions are disabled due to missing support for two_phase_beyond_autoref
-//[lxl_beyond] compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z two_phase_beyond_autoref
-//[nll_beyond] compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z two_phase_beyond_autoref -Z nll
+//[nll_beyond] compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z two_phase_beyond_autoref
 
-
-//[nll_target] compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
+//[nll_target] compile-flags: -Z borrowck=mir -Z two-phase-borrows
 
 // This is the second counter-example from Niko's blog post
 // smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/
@@ -44,9 +42,8 @@ fn main() {
 
     /*3*/ *p += 1;        // (mutable borrow of `i` starts here, since `p` is used)
 
-    /*4*/ let k = i;      //[lxl_beyond]~   ERROR cannot use `i` because it was mutably borrowed [E0503]
-                          //[nll_beyond]~^  ERROR cannot use `i` because it was mutably borrowed [E0503]
-                          //[nll_target]~^^ ERROR cannot use `i` because it was mutably borrowed [E0503]
+    /*4*/ let k = i;      //[nll_beyond]~  ERROR cannot use `i` because it was mutably borrowed [E0503]
+                          //[nll_target]~^ ERROR cannot use `i` because it was mutably borrowed [E0503]
 
     /*5*/ *p += 1;
 
index 01b04708599c03a489cdfaa2ea65deb1660acd88..15700a1d61a1fa324780195ae44d4ae40fbe10aa 100644 (file)
@@ -8,9 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// revisions: lxl nll
-//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
-//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
+// compile-flags: -Z borrowck=mir -Z two-phase-borrows
 
 // This is the third counter-example from Niko's blog post
 // smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/
@@ -26,8 +24,7 @@ fn main() {
     vec.get({
 
         vec.push(2);
-        //[lxl]~^ ERROR cannot borrow `vec` as mutable because it is also borrowed as immutable
-        //[nll]~^^   ERROR cannot borrow `vec` as mutable because it is also borrowed as immutable
+        //~^ ERROR cannot borrow `vec` as mutable because it is also borrowed as immutable
 
         0
     });
index ef39fabda10e62f744b4eb186615c49c036f86da..4303048138d91c4bbdc49f6b01445e4097f01028 100644 (file)
@@ -8,12 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// revisions: ast lxl nll
+// revisions: ast nll
 //[ast]compile-flags:
-//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
-//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
+//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows
 
-//[g2p]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll -Z two-phase-beyond-autoref
+//[g2p]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z two-phase-beyond-autoref
 // the above revision is disabled until two-phase-beyond-autoref support is better
 
 // This is a test checking that when we limit two-phase borrows to
@@ -69,44 +68,38 @@ fn overloaded_call_traits() {
 
     fn twice_ten_sm<F: FnMut(i32) -> i32>(f: &mut F) {
         f(f(10));
-        //[lxl]~^     ERROR cannot borrow `*f` as mutable more than once at a time
-        //[nll]~^^   ERROR cannot borrow `*f` as mutable more than once at a time
-        //[g2p]~^^^ ERROR cannot borrow `*f` as mutable more than once at a time
-        //[ast]~^^^^ ERROR cannot borrow `*f` as mutable more than once at a time
+        //[nll]~^   ERROR cannot borrow `*f` as mutable more than once at a time
+        //[g2p]~^^ ERROR cannot borrow `*f` as mutable more than once at a time
+        //[ast]~^^^ ERROR cannot borrow `*f` as mutable more than once at a time
     }
     fn twice_ten_si<F: Fn(i32) -> i32>(f: &mut F) {
         f(f(10));
     }
     fn twice_ten_so<F: FnOnce(i32) -> i32>(f: Box<F>) {
         f(f(10));
-        //[lxl]~^    ERROR use of moved value: `*f`
-        //[nll]~^^   ERROR use of moved value: `*f`
-        //[g2p]~^^^  ERROR use of moved value: `*f`
-        //[ast]~^^^^ ERROR use of moved value: `*f`
+        //[nll]~^   ERROR use of moved value: `*f`
+        //[g2p]~^^  ERROR use of moved value: `*f`
+        //[ast]~^^^ ERROR use of moved value: `*f`
     }
 
     fn twice_ten_om(f: &mut FnMut(i32) -> i32) {
         f(f(10));
-        //[lxl]~^    ERROR cannot borrow `*f` as mutable more than once at a time
-        //[nll]~^^   ERROR cannot borrow `*f` as mutable more than once at a time
-        //[g2p]~^^^  ERROR cannot borrow `*f` as mutable more than once at a time
-        //[ast]~^^^^ ERROR cannot borrow `*f` as mutable more than once at a time
+        //[nll]~^   ERROR cannot borrow `*f` as mutable more than once at a time
+        //[g2p]~^^  ERROR cannot borrow `*f` as mutable more than once at a time
+        //[ast]~^^^ ERROR cannot borrow `*f` as mutable more than once at a time
     }
     fn twice_ten_oi(f: &mut Fn(i32) -> i32) {
         f(f(10));
     }
     fn twice_ten_oo(f: Box<FnOnce(i32) -> i32>) {
         f(f(10));
-        //[lxl]~^             ERROR cannot move a value of type
-        //[lxl]~^^            ERROR cannot move a value of type
-        //[lxl]~^^^           ERROR use of moved value: `*f`
-        //[nll]~^^^^          ERROR cannot move a value of type
-        //[nll]~^^^^^         ERROR cannot move a value of type
-        //[nll]~^^^^^^        ERROR use of moved value: `*f`
-        //[g2p]~^^^^^^^       ERROR cannot move a value of type
-        //[g2p]~^^^^^^^^      ERROR cannot move a value of type
-        //[g2p]~^^^^^^^^^     ERROR use of moved value: `*f`
-        //[ast]~^^^^^^^^^^    ERROR use of moved value: `*f`
+        //[nll]~^          ERROR cannot move a value of type
+        //[nll]~^^         ERROR cannot move a value of type
+        //[nll]~^^^        ERROR use of moved value: `*f`
+        //[g2p]~^^^^       ERROR cannot move a value of type
+        //[g2p]~^^^^^      ERROR cannot move a value of type
+        //[g2p]~^^^^^^     ERROR use of moved value: `*f`
+        //[ast]~^^^^^^^    ERROR use of moved value: `*f`
     }
 
     twice_ten_sm(&mut |x| x + 1);
@@ -144,10 +137,9 @@ fn coerce_unsized() {
 
     // This is not okay.
     double_access(&mut a, &a);
-    //[lxl]~^    ERROR cannot borrow `a` as immutable because it is also borrowed as mutable [E0502]
-    //[nll]~^^   ERROR cannot borrow `a` as immutable because it is also borrowed as mutable [E0502]
-    //[g2p]~^^^  ERROR cannot borrow `a` as immutable because it is also borrowed as mutable [E0502]
-    //[ast]~^^^^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable [E0502]
+    //[nll]~^   ERROR cannot borrow `a` as immutable because it is also borrowed as mutable [E0502]
+    //[g2p]~^^  ERROR cannot borrow `a` as immutable because it is also borrowed as mutable [E0502]
+    //[ast]~^^^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable [E0502]
 
     // But this is okay.
     a.m(a.i(10));
@@ -173,16 +165,14 @@ fn index_mut(&mut self, _: i32) -> &mut i32 {
 fn coerce_index_op() {
     let mut i = I(10);
     i[i[3]] = 4;
-    //[lxl]~^   ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
-    //[nll]~^^  ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
-    //[ast]~^^^ ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
+    //[nll]~^  ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
+    //[ast]~^^ ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
 
     i[3] = i[4];
 
     i[i[3]] = i[4];
-    //[lxl]~^   ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
-    //[nll]~^^  ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
-    //[ast]~^^^ ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
+    //[nll]~^  ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
+    //[ast]~^^ ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
 }
 
 fn main() {
index fc9100c8a9a865f493319b2bd9444b82222e844f..f9326d944b8e4220a82896ca77c0032215700ed4 100644 (file)
@@ -8,9 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// revisions: lxl nll
-//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
-//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
+// compile-flags: -Z borrowck=mir -Z two-phase-borrows
 
 // This is similar to two-phase-reservation-sharing-interference.rs
 // in that it shows a reservation that overlaps with a shared borrow.
 #![feature(rustc_attrs)]
 
 #[rustc_error]
-fn main() { //[nll]~ ERROR compilation successful
+fn main() { //~ ERROR compilation successful
     let mut v = vec![0, 1, 2];
     let shared = &v;
 
     v.push(shared.len());
-    //[lxl]~^  ERROR cannot borrow `v` as mutable because it is also borrowed as immutable [E0502]
 
     assert_eq!(v, [0, 1, 2, 3]);
 }
index 058022ad588e85beb9ceae07b977a9e0bfbf0146..1333167b780a8537f714a571c602046dc4b29ebc 100644 (file)
 
 // ignore-tidy-linelength
 
-// revisions: lxl_beyond nll_beyond nll_target
+// revisions: nll_beyond nll_target
 
 // The following revisions are disabled due to missing support from two-phase beyond autorefs
-//[lxl_beyond]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z two-phase-beyond-autoref
-//[lxl_beyond] should-fail
-//[nll_beyond]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z two-phase-beyond-autoref -Z nll
+//[nll_beyond]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z two-phase-beyond-autoref
 //[nll_beyond] should-fail
 
-//[nll_target]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
+//[nll_target]compile-flags: -Z borrowck=mir -Z two-phase-borrows
 
 // This is a corner case that the current implementation is (probably)
 // treating more conservatively than is necessary. But it also does
@@ -46,9 +44,8 @@ fn main() {
         // with the shared borrow. But in the current implementation,
         // its an error.
         delay = &mut vec;
-        //[lxl_beyond]~^   ERROR cannot borrow `vec` as mutable because it is also borrowed as immutable
-        //[nll_beyond]~^^  ERROR cannot borrow `vec` as mutable because it is also borrowed as immutable
-        //[nll_target]~^^^ ERROR cannot borrow `vec` as mutable because it is also borrowed as immutable
+        //[nll_beyond]~^  ERROR cannot borrow `vec` as mutable because it is also borrowed as immutable
+        //[nll_target]~^^ ERROR cannot borrow `vec` as mutable because it is also borrowed as immutable
 
         shared[0];
     }
index 32747407c67f0195ee6516fca8a318a4c9de89df..eec4b470d75f76d3da7418442533b80cc49e0b4f 100644 (file)
@@ -8,9 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// revisions: lxl nll
-//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
-//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
+// cmpile-flags: -Z borrowck=mir -Z two-phase-borrows
 
 // This is the first counter-example from Niko's blog post
 // smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/
@@ -22,8 +20,7 @@ fn main() {
     v[0].push_str({
 
         v.push(format!("foo"));
-        //[lxl]~^ ERROR cannot borrow `v` as mutable more than once at a time [E0499]
-        //[nll]~^^   ERROR cannot borrow `v` as mutable more than once at a time [E0499]
+        //~^   ERROR cannot borrow `v` as mutable more than once at a time [E0499]
 
         "World!"
     });
index 0487b03171adbc2abd1e57fcb155309ac0baea43..5a05f59c6f402303676de7494218b99a260c5aa0 100644 (file)
@@ -22,6 +22,7 @@ fn double_mut_borrow<T>(x: &mut Box<T>) {
     let z = borrow_mut(x);
     //[ast]~^ ERROR cannot borrow `*x` as mutable more than once at a time
     //[mir]~^^ ERROR cannot borrow `*x` as mutable more than once at a time
+    drop((y, z));
 }
 
 fn double_imm_borrow(x: &mut Box<i32>) {
@@ -30,6 +31,7 @@ fn double_imm_borrow(x: &mut Box<i32>) {
     **x += 1;
     //[ast]~^ ERROR cannot assign to `**x` because it is borrowed
     //[mir]~^^ ERROR cannot assign to `**x` because it is borrowed
+    drop((y, z));
 }
 
 fn double_mut_borrow2<T>(x: &mut Box<T>) {
index 5f5b70dda5e8170fbe4e18035272a3ee95c102c9..e98cf4eb2abd92f3e09021c1860ef100d40b096c 100644 (file)
@@ -33,6 +33,7 @@ fn call_repeatedly<F>(f: F)
     f.call(&x);
     f.call(&x);
     x = 5;
+    drop(y);
 }
 
 fn main() {
index fc3e0633750d8c29ddd7c86092fca49fccbed399..ed6a2f85fbe23a8bb963bf61732b64239649e2d9 100644 (file)
@@ -11,6 +11,8 @@
 // revisions: ast mir
 //[mir]compile-flags: -Z borrowck=mir
 
+// FIXME(#49821) -- No tip about using a let binding
+
 use std::cell::RefCell;
 
 fn main() {
@@ -24,10 +26,9 @@ fn main() {
     //[ast]~| NOTE temporary value does not live long enough
     //[ast]~| NOTE consider using a `let` binding to increase its lifetime
     //[mir]~^^^^^ ERROR borrowed value does not live long enough [E0597]
-    //[mir]~| NOTE temporary value dropped here while still borrowed
     //[mir]~| NOTE temporary value does not live long enough
-    //[mir]~| NOTE consider using a `let` binding to increase its lifetime
+    //[mir]~| NOTE temporary value only lives until here
     println!("{}", val);
+    //[mir]~^ borrow later used here
 }
 //[ast]~^ NOTE temporary value needs to live until here
-//[mir]~^^ NOTE temporary value needs to live until here
index 6562efeb6d893a628b9ad646a2f001ccad2c21b2..d8f5956b585303847cde55e450d7aa96b1835070 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: -Z borrowck=mir -Z nll
+// compile-flags: -Z borrowck=mir
 
 #![allow(dead_code)]
 
@@ -16,7 +16,7 @@ fn bar<'a, 'b>() -> fn(&'a u32, &'b u32) -> &'a u32 {
     let g: fn(_, _) -> _ = |_x, y| y;
     //~^ ERROR free region `'b` does not outlive free region `'a`
     g
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
 }
 
 fn main() {}
index f6ad2820d17ce4d6e651eb1a88198e277767a61e..1f9174b3574a7bb57d0c5177eff5cc12067da4d7 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: -Z borrowck=mir -Z nll
+// compile-flags: -Zborrowck=mir
 
 #![allow(dead_code)]
 
@@ -44,7 +44,7 @@ fn bar<'a>(x: &'a u32) -> &'static u32 {
     // The MIR type checker must therefore relate `'?0` to `'?1` and `'?2`
     // as part of checking the `ReifyFnPointer`.
     let f: fn(_) -> _ = foo;
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR free region `'a` does not outlive free region `'static`
     f(x)
 }
index c9b378dacd540cb7bfd283efbe2d895a1f5f780c..27ca2728ddfd623a5bb74f2b2710d3531206bba4 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: -Z borrowck=mir -Z nll
+// compile-flags: -Zborrowck=mir
 
 #![allow(dead_code)]
 
@@ -16,7 +16,7 @@ fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
     // Here the NLL checker must relate the types in `f` to the types
     // in `g`. These are related via the `UnsafeFnPointer` cast.
     let g: unsafe fn(_) -> _ = f;
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR free region `'a` does not outlive free region `'static`
     unsafe { g(input) }
 }
index 1df56793f73bdab5d5c30c07d6b40f56e4253639..e30bed610581503d7bcb0910eb5d539d0e596488 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: -Z borrowck=mir -Z nll
+// compile-flags: -Z borrowck=mir
 
 #![allow(dead_code)]
 #![feature(dyn_trait)]
@@ -18,7 +18,7 @@
 fn bar<'a>(x: &'a u32) -> &'static dyn Debug {
     //~^ ERROR free region `'a` does not outlive free region `'static`
     x
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
 }
 
 fn main() {}
index 72727cdfe54d2f56b7a9331b8436ef559b3588d7..a05ee64937eb7ede999fa221e564dcb18ce8dd21 100644 (file)
@@ -25,5 +25,6 @@ fn main() {
     // check borrowing is detected successfully
     let &mut ref x = foo;
     *foo += 1; //[ast]~ ERROR cannot assign to `*foo` because it is borrowed
-               //[mir]~^ ERROR cannot assign to `*foo` because it is borrowed
+    //[mir]~^ ERROR cannot assign to `*foo` because it is borrowed
+    drop(x);
 }
index fdc650a072131c4e4f1a46b34b1acab76ee3bec7..97126e98cbf3ad3ab09efb5401d057d15990ad68 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-// compile-flags:-Zborrowck=compare -Znll
+// compile-flags:-Zborrowck=compare
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
index f22d2fc23e0579eb691d73167a5967797206fa63..b5357d0ee827c100fbb1ebdaf9b2541036dad9a8 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-// compile-flags:-Zborrowck=compare -Znll
+// compile-flags:-Zborrowck=compare
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
index efa6cc273b6f4a66e32623fbcef67d1f92b73f5c..589a3daa38d853dc344b8bf2faa6602353ee9d33 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 //revisions: ast mir
-//[mir] compile-flags: -Z borrowck=mir -Z nll
+//[mir] compile-flags: -Z borrowck=mir
 
 #![allow(unused_assignments)]
 
index 1128d65af95c5832139ca934347dff5b4ef226e4..e1c47a6bbff2cea9b0bf3f20c7a16a7a590ab692 100644 (file)
@@ -12,7 +12,7 @@
 // in the type of `p` includes the points after `&v[0]` up to (but not
 // including) the call to `use_x`. The `else` branch is not included.
 
-// compile-flags:-Zborrowck=compare -Znll
+// compile-flags:-Zborrowck=compare
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
index 7ed59ef2a879b9fdb96fda2292d84a609e96da1f..13f1ca6431b3d8e4adf793ec5310cd16c3494040 100644 (file)
@@ -12,7 +12,7 @@
 // in the type of `p` includes the points after `&v[0]` up to (but not
 // including) the call to `use_x`. The `else` branch is not included.
 
-// compile-flags:-Zborrowck=compare -Znll
+// compile-flags:-Zborrowck=compare
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
index ecea8756903aeb9f694ef3830f3a1fa7ab20e2ef..1a3dc76005db4629f86595c575aef3e1e5641b04 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: -Z borrowck=mir -Z nll
+// compile-flags: -Zborrowck=mir
 
 #![allow(dead_code)]
 
@@ -22,7 +22,7 @@ fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32)
 fn bar<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
     foo(x, y)
     //~^ ERROR lifetime mismatch [E0623]
-    //~| WARNING not reporting region error due to -Znll
+    //~| WARNING not reporting region error due to nll
 }
 
 fn main() {}
index f1a6dc48e13b80ed809652e7cb18c8042626dfcb..69f0f43af13425af0d5942286d4cefc3d1806a51 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: -Z borrowck=mir -Z nll
+// compile-flags: -Z borrowck=mir
 
 #![allow(dead_code)]
 
@@ -22,7 +22,7 @@ struct Foo<'a: 'b, 'b> {
 fn bar<'a, 'b>(x: Cell<&'a u32>, y: Cell<&'b u32>) {
     Foo { x, y };
     //~^ ERROR lifetime mismatch [E0623]
-    //~| WARNING not reporting region error due to -Znll
+    //~| WARNING not reporting region error due to nll
 }
 
 fn main() {}
index 6fbc65ce6a71f3a01729e240dab2abb9b1b27cbd..1f23dcbb72523baaeb6689d55fd7a144cfde4d58 100644 (file)
@@ -18,7 +18,8 @@ fn main() {
     match (&a1,) {
         (&ref b0,) => {
             a1 = &f; //[ast]~ ERROR cannot assign
-                     //[mir]~^ ERROR cannot assign to `a1` because it is borrowed
+            //[mir]~^ ERROR cannot assign to `a1` because it is borrowed
+            drop(b0);
         }
     }
 }
index 13f93090fbbb4fae5260fe6296d19cca0a8ca8bb..a0097b9f6d7df84ae0e3ce2e8e59cabc5bec13e0 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // revisions: ll nll
-//[nll] compile-flags: -Znll -Zborrowck=mir
+//[nll] compile-flags:-Zborrowck=mir
 
 fn static_id<'a,'b>(t: &'a ()) -> &'static ()
     where 'a: 'static { t }
@@ -17,16 +17,16 @@ fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static ()
     where 'a: 'b, 'b: 'static { t }
 fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
     t //[ll]~ ERROR E0312
-        //[nll]~^ WARNING not reporting region error due to -Znll
+        //[nll]~^ WARNING not reporting region error due to nll
         //[nll]~| ERROR free region `'a` does not outlive free region `'static`
 }
 
 fn error(u: &(), v: &()) {
     static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621]
-    //[nll]~^ WARNING not reporting region error due to -Znll
+    //[nll]~^ WARNING not reporting region error due to nll
     //[nll]~| ERROR explicit lifetime required in the type of `u` [E0621]
     static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621]
-    //[nll]~^ WARNING not reporting region error due to -Znll
+    //[nll]~^ WARNING not reporting region error due to nll
     //[nll]~| ERROR explicit lifetime required in the type of `v` [E0621]
 }
 
index 09288cf69ff586064efc7116894ccf6d5257dc89..f41b39845a579681bf5811aa2e9fcebc4deac32b 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll
+// compile-flags:-Zborrowck=mir
 
 fn can_panic() -> Box<usize> {
     Box::new(44)
index 64ffc7446062cb171b7ced9ca4e792e0e16ce304..073b44d6e338763ef9a8a5d63d289469b7012d8f 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll
+// compile-flags:-Zborrowck=mir
 
 #![allow(warnings)]
 
index 671f5e5292aa439029b6e98221ed7e51bb9da502..6a8749084068a30fa6afcd518b5a2b0cb1f14a44 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll
+// compile-flags:-Zborrowck=mir
 
 fn cond() -> bool { false }
 
index 8feac15d69a82a484b442589d047b18fb95c003b..5cca3e55259d0f874ff7b81fdd0af9a401a64b69 100644 (file)
@@ -13,8 +13,8 @@
 // suitable variables and that we setup the outlives relationship
 // between R0 and R1 properly.
 
-// compile-flags:-Znll -Zverbose
-//                     ^^^^^^^^^ force compiler to dump more region information
+// compile-flags:-Zborrowck=mir -Zverbose
+//                              ^^^^^^^^^ force compiler to dump more region information
 // ignore-tidy-linelength
 
 #![allow(warnings)]
index 92e42a73bbb6a9679fe764e804cf55d30acb6928..b7c8d81b77fdbaf91b0caeefda1d9c578731ebcb 100644 (file)
@@ -12,8 +12,8 @@
 // in the type of `r_a` must outlive the region (`R7`) that appears in
 // the type of `r_b`
 
-// compile-flags:-Znll -Zverbose
-//                     ^^^^^^^^^ force compiler to dump more region information
+// compile-flags:-Zborrowck=mir -Zverbose
+//                              ^^^^^^^^^ force compiler to dump more region information
 
 #![allow(warnings)]
 
index 19d733d4f6b6a8931bdc0a4d2b5617b970b7b85c..75d8a6a4f6ac55ca3b830ecf4a58b3e79a9bade7 100644 (file)
@@ -12,8 +12,8 @@
 // in the type of `p` includes the points after `&v[0]` up to (but not
 // including) the call to `use_x`. The `else` branch is not included.
 
-// compile-flags:-Znll -Zverbose
-//                     ^^^^^^^^^ force compiler to dump more region information
+// compile-flags:-Zborrowck=mir -Zverbose
+//                              ^^^^^^^^^ force compiler to dump more region information
 
 #![allow(warnings)]
 
index 821cd73667193afb145773501869b5755a5ab314..153739133ac82900258866451e2cdf16a1be753d 100644 (file)
@@ -14,8 +14,8 @@
 // but only at a particular point, and hence they wind up including
 // distinct regions.
 
-// compile-flags:-Znll -Zverbose
-//                     ^^^^^^^^^ force compiler to dump more region information
+// compile-flags:-Zborrowck=mir -Zverbose
+//                              ^^^^^^^^^ force compiler to dump more region information
 
 #![allow(warnings)]
 
index a3f68ed5ebf5eecd7f7f17d8bafb2bced9318296..16952143d0a5bc6a294682f139da8c89adbf6795 100644 (file)
@@ -12,8 +12,8 @@
 // in the type of `p` includes the points after `&v[0]` up to (but not
 // including) the call to `use_x`. The `else` branch is not included.
 
-// compile-flags:-Znll -Zverbose
-//                     ^^^^^^^^^ force compiler to dump more region information
+// compile-flags:-Zborrowck=mir -Zverbose
+//                              ^^^^^^^^^ force compiler to dump more region information
 
 #![allow(warnings)]
 
index 66234449263982ad635838fecdbb1da69df100e8..ca15591a10192deee48078ca565dca0c2691d391 100644 (file)
@@ -8,9 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// revisions: lxl nll
-//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
-//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
+// compile-flags: -Z borrowck=mir -Z two-phase-borrows
 
 // This is the "goto example" for why we want two phase borrows.
 
index b1db203071788cce72e3acf9e271c41897cdea06..e3b7322e48b6b93ac2b05050dc98417cdb818982 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // revisions: normal nll
-//[nll] compile-flags: -Znll -Zborrowck=mir
+//[nll] compile-flags:-Zborrowck=mir
 
 #![feature(fn_traits,
            step_trait,
index b6946154fa00a0a5870c495b172305b8cf2657fd..55e73af9e6a1ba06f1a6616b76e5a46ad547d5ec 100644 (file)
@@ -23,6 +23,7 @@ fn a() {
     let c1 = to_fn_mut(|| x = 4);
     let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
     //~| ERROR cannot borrow `x` as mutable more than once
+    drop((c1, c2));
 }
 
 fn set(x: &mut isize) {
@@ -34,6 +35,7 @@ fn b() {
     let c1 = to_fn_mut(|| set(&mut x));
     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
     //~| ERROR cannot borrow `x` as mutable more than once
+    drop((c1, c2));
 }
 
 fn c() {
@@ -41,6 +43,7 @@ fn c() {
     let c1 = to_fn_mut(|| x = 5);
     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
     //~| ERROR cannot borrow `x` as mutable more than once
+    drop((c1, c2));
 }
 
 fn d() {
@@ -49,6 +52,7 @@ fn d() {
     let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
     //~^ ERROR cannot borrow `x` as mutable more than once
     //~| ERROR cannot borrow `x` as mutable more than once
+    drop((c1, c2));
 }
 
 fn g() {
@@ -61,6 +65,7 @@ struct Foo {
     let c2 = to_fn_mut(|| set(&mut *x.f));
     //~^ ERROR cannot borrow `x` as mutable more than once
     //~| ERROR cannot borrow `x` as mutable more than once
+    drop((c1, c2));
 }
 
 fn main() {
index c739165ddbd3734568b45d54d6170a06531abc81..a4f8e8b408ba501b15e6783764e00a01b8e309f0 100644 (file)
@@ -9,12 +9,12 @@ LL |     let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable mo
    |                        ^^ - borrow occurs due to use of `x` in closure
    |                        |
    |                        second mutable borrow occurs here
-LL |     //~| ERROR cannot borrow `x` as mutable more than once
+...
 LL | }
    | - first borrow ends here
 
 error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
-  --> $DIR/borrowck-closures-two-mut.rs:35:24
+  --> $DIR/borrowck-closures-two-mut.rs:36:24
    |
 LL |     let c1 = to_fn_mut(|| set(&mut x));
    |                        --          - previous borrow occurs due to use of `x` in closure
@@ -24,12 +24,12 @@ LL |     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as muta
    |                        ^^          - borrow occurs due to use of `x` in closure
    |                        |
    |                        second mutable borrow occurs here
-LL |     //~| ERROR cannot borrow `x` as mutable more than once
+...
 LL | }
    | - first borrow ends here
 
 error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
-  --> $DIR/borrowck-closures-two-mut.rs:42:24
+  --> $DIR/borrowck-closures-two-mut.rs:44:24
    |
 LL |     let c1 = to_fn_mut(|| x = 5);
    |                        -- - previous borrow occurs due to use of `x` in closure
@@ -39,12 +39,12 @@ LL |     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as muta
    |                        ^^          - borrow occurs due to use of `x` in closure
    |                        |
    |                        second mutable borrow occurs here
-LL |     //~| ERROR cannot borrow `x` as mutable more than once
+...
 LL | }
    | - first borrow ends here
 
 error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
-  --> $DIR/borrowck-closures-two-mut.rs:49:24
+  --> $DIR/borrowck-closures-two-mut.rs:52:24
    |
 LL |     let c1 = to_fn_mut(|| x = 5);
    |                        -- - previous borrow occurs due to use of `x` in closure
@@ -59,7 +59,7 @@ LL | }
    | - first borrow ends here
 
 error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
-  --> $DIR/borrowck-closures-two-mut.rs:61:24
+  --> $DIR/borrowck-closures-two-mut.rs:65:24
    |
 LL |     let c1 = to_fn_mut(|| set(&mut *x.f));
    |                        --           - previous borrow occurs due to use of `x` in closure
@@ -85,11 +85,11 @@ LL |     let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable mo
    |                        |
    |                        second mutable borrow occurs here
 LL |     //~| ERROR cannot borrow `x` as mutable more than once
-LL | }
-   | - first borrow ends here
+LL |     drop((c1, c2));
+   |           -- borrow later used here
 
 error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
-  --> $DIR/borrowck-closures-two-mut.rs:35:24
+  --> $DIR/borrowck-closures-two-mut.rs:36:24
    |
 LL |     let c1 = to_fn_mut(|| set(&mut x));
    |                        --          - previous borrow occurs due to use of `x` in closure
@@ -100,11 +100,11 @@ LL |     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as muta
    |                        |
    |                        second mutable borrow occurs here
 LL |     //~| ERROR cannot borrow `x` as mutable more than once
-LL | }
-   | - first borrow ends here
+LL |     drop((c1, c2));
+   |           -- borrow later used here
 
 error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
-  --> $DIR/borrowck-closures-two-mut.rs:42:24
+  --> $DIR/borrowck-closures-two-mut.rs:44:24
    |
 LL |     let c1 = to_fn_mut(|| x = 5);
    |                        -- - previous borrow occurs due to use of `x` in closure
@@ -115,11 +115,11 @@ LL |     let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as muta
    |                        |
    |                        second mutable borrow occurs here
 LL |     //~| ERROR cannot borrow `x` as mutable more than once
-LL | }
-   | - first borrow ends here
+LL |     drop((c1, c2));
+   |           -- borrow later used here
 
 error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
-  --> $DIR/borrowck-closures-two-mut.rs:49:24
+  --> $DIR/borrowck-closures-two-mut.rs:52:24
    |
 LL |     let c1 = to_fn_mut(|| x = 5);
    |                        -- - previous borrow occurs due to use of `x` in closure
@@ -130,11 +130,11 @@ LL |     let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nes
    |                        |
    |                        second mutable borrow occurs here
 ...
-LL | }
-   | - first borrow ends here
+LL |     drop((c1, c2));
+   |           -- borrow later used here
 
 error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
-  --> $DIR/borrowck-closures-two-mut.rs:61:24
+  --> $DIR/borrowck-closures-two-mut.rs:65:24
    |
 LL |     let c1 = to_fn_mut(|| set(&mut *x.f));
    |                        --           - previous borrow occurs due to use of `x` in closure
@@ -145,8 +145,8 @@ LL |     let c2 = to_fn_mut(|| set(&mut *x.f));
    |                        |
    |                        second mutable borrow occurs here
 ...
-LL | }
-   | - first borrow ends here
+LL |     drop((c1, c2));
+   |           -- borrow later used here
 
 error: aborting due to 10 previous errors
 
index e690263a916f3cf5f42750f229a1fb8f424b25eb..6d7ed61bdd8b550073f324894a7912a07c700e22 100644 (file)
@@ -8,9 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// revisions: lxl nll
-//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
-//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
+// compile-flags: -Z borrowck=mir -Z two-phase-borrows
 
 // run-pass
 
index e1ed41bfb2c64cb97e9fd3bf92ed672e3cc518ca..9ea9696511b7194ba0e330dfc8e9e69137ad4535 100644 (file)
@@ -8,9 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// revisions: lxl nll
-//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
-//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
+// compile-flags: -Z borrowck=mir -Z two-phase-borrows
 
 // run-pass
 
index 7734b14b2ab7b008f3a10d5469f5538dae8389c7..b8be209833a6e15a3c3f1dd5cda254080c6913e0 100644 (file)
@@ -30,6 +30,7 @@ fn main() {
         *y.pointer += 1;
         //~^ ERROR cannot assign to `*y.pointer` because it is borrowed (Ast) [E0506]
         //~| ERROR cannot use `*y.pointer` because it was mutably borrowed (Mir) [E0503]
+        //~| ERROR cannot assign to `*y.pointer` because it is borrowed (Mir) [E0506]
         *z.pointer += 1;
     }
 }
index aa899c5aee9eb429ba4ad2ca36df1193bcac2f3b..cf108691a0e4f65a2034c7ca927a1a79450e00b4 100644 (file)
@@ -13,8 +13,22 @@ LL |         let z = copy_borrowed_ptr(&mut y);
    |                                   ------ borrow of `y` occurs here
 LL |         *y.pointer += 1;
    |         ^^^^^^^^^^^^^^^ use of borrowed `y`
+...
+LL |         *z.pointer += 1;
+   |         --------------- borrow later used here
 
-error: aborting due to 2 previous errors
+error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Mir)
+  --> $DIR/issue-45697-1.rs:30:9
+   |
+LL |         let z = copy_borrowed_ptr(&mut y);
+   |                                   ------ borrow of `*y.pointer` occurs here
+LL |         *y.pointer += 1;
+   |         ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
+...
+LL |         *z.pointer += 1;
+   |         --------------- borrow later used here
+
+error: aborting due to 3 previous errors
 
 Some errors occurred: E0503, E0506.
 For more information about an error, try `rustc --explain E0503`.
index 4e93eccd6f6496ee1f4fde63302ed376073117cc..27acc2c89f75d435060f6baa2a32e40abe7b5744 100644 (file)
@@ -30,6 +30,7 @@ fn main() {
         *y.pointer += 1;
         //~^ ERROR cannot assign to `*y.pointer` because it is borrowed (Ast) [E0506]
         //~| ERROR cannot use `*y.pointer` because it was mutably borrowed (Mir) [E0503]
+        //~| ERROR cannot assign to `*y.pointer` because it is borrowed (Mir) [E0506]
         *z.pointer += 1;
     }
 }
index babfc33b94582b7254e834f8e583295b8be1dabc..a85972fcd7a1c05b6e24577a7352cf3ba92a7ca4 100644 (file)
@@ -13,8 +13,22 @@ LL |         let z = copy_borrowed_ptr(&mut y);
    |                                   ------ borrow of `y` occurs here
 LL |         *y.pointer += 1;
    |         ^^^^^^^^^^^^^^^ use of borrowed `y`
+...
+LL |         *z.pointer += 1;
+   |         --------------- borrow later used here
 
-error: aborting due to 2 previous errors
+error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Mir)
+  --> $DIR/issue-45697.rs:30:9
+   |
+LL |         let z = copy_borrowed_ptr(&mut y);
+   |                                   ------ borrow of `*y.pointer` occurs here
+LL |         *y.pointer += 1;
+   |         ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
+...
+LL |         *z.pointer += 1;
+   |         --------------- borrow later used here
+
+error: aborting due to 3 previous errors
 
 Some errors occurred: E0503, E0506.
 For more information about an error, try `rustc --explain E0503`.
index bfd5bfa9f7274e5185504f7ae9b7bf913807a074..0108056bc7278265ae61aba0d7c536908bfcd6d8 100644 (file)
@@ -12,13 +12,16 @@ LL | }
 error[E0597]: `z` does not live long enough (Mir)
   --> $DIR/issue-46471-1.rs:16:9
    |
-LL |         &mut z
-   |         ^^^^^^ borrowed value does not live long enough
-LL |     };
-   |     - `z` dropped here while still borrowed
-...
-LL | }
-   | - borrowed value needs to live until here
+LL |       let y = {
+   |  _____________-
+LL | |         let mut z = 0;
+LL | |         &mut z
+   | |         ^^^^^^ borrowed value does not live long enough
+LL | |     };
+   | |     -
+   | |     |
+   | |_____borrowed value only lives until here
+   |       borrow later used here
 
 error: aborting due to 2 previous errors
 
index 41c744fec6e762024430a75c82cc4ed51acc1534..1e168028c7c9a9c48f2be595d7eb6026ae445ccf 100644 (file)
@@ -22,7 +22,7 @@
 // that appear free in its type (hence, we see it before the closure's
 // "external requirements" report).
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
@@ -35,7 +35,7 @@ fn test() {
         let y = 22;
         let mut closure = expect_sig(|p, y| *p = y);
         //~^ ERROR does not outlive free region
-        //~| WARNING not reporting region error due to -Znll
+        //~| WARNING not reporting region error due to nll
         closure(&mut p, &y);
     }
 
index 5f84001a8fb99163b294a5158af44e90d9ec1257..d876c751a41d2aa13e1f7c5475cacc320a39496e 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/escape-argument-callee.rs:36:50
    |
 LL |         let mut closure = expect_sig(|p, y| *p = y);
index 7e918c6431de4450e874558b91bee2001218119e..7a28cb26f3570620998ebdff319b76249e677ac9 100644 (file)
@@ -22,7 +22,7 @@
 // basically checking that the MIR type checker correctly enforces the
 // closure signature.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
index 05700ae00ad4f72900ad96f2cdec06474a528f22..598839f872e01805bc1d896c3f6755754cdc8500 100644 (file)
@@ -15,7 +15,7 @@
 //
 // except that the closure does so via a second closure.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
index 93d8bfafcbaa4ffed82d2b0be51f828a7d2b679b..49d31bbc139d73f0b88aca1551900018681a7e6c 100644 (file)
@@ -19,7 +19,7 @@
 // `'b`.  This relationship is propagated to the closure creator,
 // which reports an error.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
index 30a6dfc5b3edd05bf737f99c8b22c69a633f4427..e7ec0b9684d2c980d785f8b7a6093e6e521a6ae0 100644 (file)
@@ -11,7 +11,7 @@
 // Test where we fail to approximate due to demanding a postdom
 // relationship between our upper bounds.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
@@ -53,7 +53,7 @@ fn supply<'a, 'b, 'c>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>, cell_c: Cell
         |_outlives1, _outlives2, _outlives3, x, y| {
             // Only works if 'x: 'y:
             let p = x.get();
-            //~^ WARN not reporting region error due to -Znll
+            //~^ WARN not reporting region error due to nll
             //~| ERROR does not outlive free region
             demand_y(x, y, p)
         },
index 0c058e40a5086927d99222a31a43566385c060c0..ef5a31e40d445afa5c9c55a615607f66fbf8c075 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/propagate-approximated-fail-no-postdom.rs:55:21
    |
 LL |             let p = x.get();
@@ -16,7 +16,7 @@ note: No external requirements
 LL | /         |_outlives1, _outlives2, _outlives3, x, y| {
 LL | |             // Only works if 'x: 'y:
 LL | |             let p = x.get();
-LL | |             //~^ WARN not reporting region error due to -Znll
+LL | |             //~^ WARN not reporting region error due to nll
 LL | |             //~| ERROR does not outlive free region
 LL | |             demand_y(x, y, p)
 LL | |         },
index 91128035f3d95162d81615b188c68c3ecde35611..da8ce55162f37e706ce35dbfb4cf9f4386449389 100644 (file)
@@ -22,7 +22,7 @@
 // Note: the use of `Cell` here is to introduce invariance. One less
 // variable.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
@@ -54,7 +54,7 @@ fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
         //~^ ERROR lifetime mismatch
 
         // Only works if 'x: 'y:
-        demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll
+        demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
     });
 }
 
index 947b95b1c53218887a257a4470b2153f3d91c855..3a3236fd16c49e03b90e7edb007867ec646b131b 100644 (file)
@@ -1,7 +1,7 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/propagate-approximated-ref.rs:57:9
    |
-LL |         demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll
+LL |         demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
    |         ^^^^^^^^^^^^^^^^^^^^^^^
 
 note: External requirements
@@ -12,7 +12,7 @@ LL |       establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x,
 LL | |         //~^ ERROR lifetime mismatch
 LL | |
 LL | |         // Only works if 'x: 'y:
-LL | |         demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll
+LL | |         demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
 LL | |     });
    | |_____^
    |
index f210346a82a675b1f9a5062cbd063f320a56306d..84bfd6ea4f25324cb479b77ce5b01ce333e0468a 100644 (file)
@@ -12,7 +12,7 @@
 // where `'x` is bound in closure type but `'a` is free. This forces
 // us to approximate `'x` one way or the other.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
@@ -29,7 +29,7 @@ fn case1() {
     let a = 0;
     let cell = Cell::new(&a);
     foo(cell, |cell_a, cell_x| {
-        //~^ WARNING not reporting region error due to -Znll
+        //~^ WARNING not reporting region error due to nll
         cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure
         //~^ ERROR does not outlive free region
     })
index d39cdc34471abcf3615064c0614af3d88f117c85..6480cbe44312785885070fecd8df69f1e508e829 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:31:5
    |
 LL |     foo(cell, |cell_a, cell_x| {
@@ -15,7 +15,7 @@ note: No external requirements
    |
 LL |       foo(cell, |cell_a, cell_x| {
    |  _______________^
-LL | |         //~^ WARNING not reporting region error due to -Znll
+LL | |         //~^ WARNING not reporting region error due to nll
 LL | |         cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure
 LL | |         //~^ ERROR does not outlive free region
 LL | |     })
index c66472d5ce9b1ec1060843ca0532457e56e61e1c..df715c52921a0de5033f0303daa4bb37b1dc33d6 100644 (file)
@@ -16,7 +16,7 @@
 // FIXME(#45827) Because of shortcomings in the MIR type checker,
 // these errors are not (yet) reported.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
@@ -46,7 +46,7 @@ fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
         //~^ ERROR does not outlive free region
 
         // Only works if 'x: 'y:
-        demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll
+        demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
     });
 }
 
index 3131142ec73bfcda7e0ff840d3ff691c66117d50..6dcc8421177d9cf37cd3b06b2ecc02e984597379 100644 (file)
@@ -1,7 +1,7 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:49:9
    |
-LL |         demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll
+LL |         demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
    |         ^^^^^^^^^^^^^^^^^^^^^^^
 
 note: External requirements
@@ -12,7 +12,7 @@ LL |       establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
 LL | |         //~^ ERROR does not outlive free region
 LL | |
 LL | |         // Only works if 'x: 'y:
-LL | |         demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll
+LL | |         demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
 LL | |     });
    | |_____^
    |
@@ -31,7 +31,7 @@ LL |       establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
 LL | |         //~^ ERROR does not outlive free region
 LL | |
 LL | |         // Only works if 'x: 'y:
-LL | |         demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll
+LL | |         demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
 LL | |     });
    | |_____^
 
index f4011a0e5335e8fdee25a809af6ef98ef133a545..fdbb312572f894dd3085ffe80490844f864b868e 100644 (file)
@@ -17,7 +17,7 @@
 // FIXME(#45827) Because of shortcomings in the MIR type checker,
 // these errors are not (yet) reported.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
@@ -49,7 +49,7 @@ fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
         //~^ ERROR does not outlive free region
         // Only works if 'x: 'y:
         demand_y(x, y, x.get())
-        //~^ WARNING not reporting region error due to -Znll
+        //~^ WARNING not reporting region error due to nll
     });
 }
 
index 5b038653b606837d4cabf8afeb8be70ebd11bd42..1291f2e9901b0e75880cc4245891dd2c5f8e2332 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:51:9
    |
 LL |         demand_y(x, y, x.get())
@@ -12,7 +12,7 @@ LL |       establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x,
 LL | |         //~^ ERROR does not outlive free region
 LL | |         // Only works if 'x: 'y:
 LL | |         demand_y(x, y, x.get())
-LL | |         //~^ WARNING not reporting region error due to -Znll
+LL | |         //~^ WARNING not reporting region error due to nll
 LL | |     });
    | |_____^
    |
@@ -31,7 +31,7 @@ LL |       establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x,
 LL | |         //~^ ERROR does not outlive free region
 LL | |         // Only works if 'x: 'y:
 LL | |         demand_y(x, y, x.get())
-LL | |         //~^ WARNING not reporting region error due to -Znll
+LL | |         //~^ WARNING not reporting region error due to nll
 LL | |     });
    | |_____^
 
index d163f304ae5b17f2509448dd3f1404e8b2aec70c..0449dc1d1a75c2846134f95c52c21993c79f43c1 100644 (file)
@@ -15,7 +15,7 @@
 // relationships. In the 'main' variant, there are a number of
 // anonymous regions as well.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
@@ -47,7 +47,7 @@ fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
         //~^ ERROR lifetime mismatch
 
         // Only works if 'x: 'y:
-        demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to -Znll
+        demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to nll
     });
 }
 
index 475fdd947817e4e3e7162deee01c68923799c72f..d1824a941510266033b5750f0fe6f39f4b7cfbdc 100644 (file)
@@ -1,7 +1,7 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/propagate-approximated-val.rs:50:9
    |
-LL |         demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to -Znll
+LL |         demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to nll
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 note: External requirements
@@ -12,7 +12,7 @@ LL |       establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y|
 LL | |         //~^ ERROR lifetime mismatch
 LL | |
 LL | |         // Only works if 'x: 'y:
-LL | |         demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to -Znll
+LL | |         demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to nll
 LL | |     });
    | |_____^
    |
index 1ccfa61f4ce4665b86869b19b0ab57b3476ed096..c21c824b22c3bb093bf74f2c5fda51bcd94cfc73 100644 (file)
@@ -13,7 +13,7 @@
 // need to propagate; but in fact we do because identity of free
 // regions is erased.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 // compile-pass
 
 #![feature(rustc_attrs)]
index ab4faaca756331c8f472a1c8ee271b6f18ae26a5..d6eeda881daf26b91920981ded1076cda25aadd9 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/propagate-despite-same-free-region.rs:54:21
    |
 LL |             let p = x.get();
index eb512a3b9b1fb13eded1a71570b5c7510a9b82ac..7699d101734958122ee2eca1d296521de81ddeae 100644 (file)
@@ -17,7 +17,7 @@
 // as it knows of no relationships between `'x` and any
 // non-higher-ranked regions.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
@@ -45,7 +45,7 @@ fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
     establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
         // Only works if 'x: 'y:
         demand_y(x, y, x.get())
-        //~^ WARN not reporting region error due to -Znll
+        //~^ WARN not reporting region error due to nll
         //~| ERROR does not outlive free region
     });
 }
index ce808f56b42974ee4bf4b8827ead3fe005adea46..ffae47bd081c33119a0ab55ab012ab22e6c2f188 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:47:9
    |
 LL |         demand_y(x, y, x.get())
@@ -17,7 +17,7 @@ LL |       establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
    |  _______________________________________________^
 LL | |         // Only works if 'x: 'y:
 LL | |         demand_y(x, y, x.get())
-LL | |         //~^ WARN not reporting region error due to -Znll
+LL | |         //~^ WARN not reporting region error due to nll
 LL | |         //~| ERROR does not outlive free region
 LL | |     });
    | |_____^
index 930742464297202f9abd7f651fa9189c11935d01..afb61b221be942394a2e011734a7a0ae1fda1bda 100644 (file)
@@ -17,7 +17,7 @@
 // as it only knows of regions that `'x` is outlived by, and none that
 // `'x` outlives.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
@@ -49,7 +49,7 @@ fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
     establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
         // Only works if 'x: 'y:
         demand_y(x, y, x.get())
-        //~^ WARN not reporting region error due to -Znll
+        //~^ WARN not reporting region error due to nll
         //~| ERROR does not outlive free region
     });
 }
index 547ff75bac62c5d363add30ef27f30262c2da0f0..01af756b8332c639632b9047d6083bcc0162e3e3 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:51:9
    |
 LL |         demand_y(x, y, x.get())
@@ -17,7 +17,7 @@ LL |       establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x,
    |  _______________________________________________^
 LL | |         // Only works if 'x: 'y:
 LL | |         demand_y(x, y, x.get())
-LL | |         //~^ WARN not reporting region error due to -Znll
+LL | |         //~^ WARN not reporting region error due to nll
 LL | |         //~| ERROR does not outlive free region
 LL | |     });
    | |_____^
index 91796355752a5eb00af3da727479fae8bfbf5bf0..7baf24f88f8fa419b35643e9304b973decd1039e 100644 (file)
@@ -14,7 +14,7 @@
 // the same `'a` for which it implements `Trait`, which can only be the `'a`
 // from the function definition.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 #![allow(dead_code)]
@@ -53,7 +53,7 @@ fn supply<'a, T>(value: T)
         // The latter does not hold.
 
         require(value);
-        //~^ WARNING not reporting region error due to -Znll
+        //~^ WARNING not reporting region error due to nll
     });
 }
 
index 5bdfc7e935fea99557e50fece0c83efe90ddb6fc..a8b4ed528015fbf3c9e26a92ce0c6429d51cfd8d 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/propagate-from-trait-match.rs:55:9
    |
 LL |         require(value);
@@ -13,7 +13,7 @@ LL | |         //~^ ERROR the parameter type `T` may not live long enough
 LL | |
 LL | |         // This function call requires that
 ...  |
-LL | |         //~^ WARNING not reporting region error due to -Znll
+LL | |         //~^ WARNING not reporting region error due to nll
 LL | |     });
    | |_____^
    |
@@ -35,7 +35,7 @@ LL | |         //~^ ERROR the parameter type `T` may not live long enough
 LL | |
 LL | |         // This function call requires that
 ...  |
-LL | |         //~^ WARNING not reporting region error due to -Znll
+LL | |         //~^ WARNING not reporting region error due to nll
 LL | |     });
    | |_____^
    |
index ac21fe25bd112e5a9183bb737012f15b9d06704c..a6b2e531ac28fcf9cb0e4d75a41cef1d921aafa5 100644 (file)
 // a variety of errors from the older, AST-based machinery (notably
 // borrowck), and then we get the NLL error at the end.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 fn foo(x: &u32) -> &'static u32 {
     &*x
-        //~^ WARN not reporting region error due to -Znll
+        //~^ WARN not reporting region error due to nll
         //~| ERROR explicit lifetime required in the type of `x`
 }
 
index 1e93ae1ee07c6f828810d8cd9c26d9ac68656e15..a823e62d3b843f76b5184a2eeb305dfd46664a7a 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/region-lbr-anon-does-not-outlive-static.rs:19:5
    |
 LL |     &*x
index a1be8e851851599161c10f5e79b868bede8f43d3..dedbd8df41b130ca8d771fcd71418e092cffa38e 100644 (file)
 // a variety of errors from the older, AST-based machinery (notably
 // borrowck), and then we get the NLL error at the end.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 fn foo<'a>(x: &'a u32) -> &'static u32 {
     &*x
-        //~^ WARN not reporting region error due to -Znll
+        //~^ WARN not reporting region error due to nll
         //~| ERROR does not outlive free region
 }
 
index ac3bf4b459fec119d7744fed078ec6f147d3e1e2..9520b446303c3fc8c06cef12e97ebb099734f082 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/region-lbr-named-does-not-outlive-static.rs:19:5
    |
 LL |     &*x
index 00b09e2ab21ada08e8600b54eb510271993ea1c1..8598668bef50ea59002d5466e6d895976a97d7bc 100644 (file)
 // a variety of errors from the older, AST-based machinery (notably
 // borrowck), and then we get the NLL error at the end.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 {
     &*x
-        //~^ WARN not reporting region error due to -Znll
+        //~^ WARN not reporting region error due to nll
         //~| ERROR lifetime mismatch
 }
 
index 3af6d7d21f75310c484546931587dd004ac63acf..415aefdeee947a97b91f71c667aa57cc82a78f64 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/region-lbr1-does-not-outlive-ebr2.rs:19:5
    |
 LL |     &*x
index 7454a8e71f2708c7b1a1a46b8f1bc011e4b1e93a..6d2bb30980236dd42a6655a3bfdbede99de99f4b 100644 (file)
@@ -11,7 +11,7 @@
 // Basic test for free regions in the NLL code. This test does not
 // report an error because of the (implied) bound that `'b: 'a`.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 // compile-pass
 
 #![allow(warnings)]
index 754df4f2c5db624b95f6dfdab3b49da248635869..60f82ca0eefb9a9a5add36cfb845cdb9739a6bd5 100644 (file)
 // the first, but actually returns the second. This should fail within
 // the closure.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
 #[rustc_regions]
 fn test() {
     expect_sig(|a, b| b); // ought to return `a`
-    //~^ WARN not reporting region error due to -Znll
+    //~^ WARN not reporting region error due to nll
     //~| ERROR does not outlive free region
 }
 
index b34f4c470df49da99fef7a622cfcc0797619d964..4d021fb545494c9a6ccb7798d7b8a64cab817fcd 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/return-wrong-bound-region.rs:21:23
    |
 LL |     expect_sig(|a, b| b); // ought to return `a`
@@ -26,7 +26,7 @@ note: No external requirements
    |
 LL | / fn test() {
 LL | |     expect_sig(|a, b| b); // ought to return `a`
-LL | |     //~^ WARN not reporting region error due to -Znll
+LL | |     //~^ WARN not reporting region error due to nll
 LL | |     //~| ERROR does not outlive free region
 LL | | }
    | |_^
index 589d8ffd28f0b3aeeff8b301f2a36270635ec596..10ce0652d43c2f6df54b6b698ff4220d7c9c74ca 100644 (file)
@@ -11,7 +11,7 @@
 // Test that MIR borrowck and NLL analysis can handle constants of
 // arbitrary types without ICEs.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 // compile-pass
 
 const HI: &str = "hi";
index 6dcbe0a528d90a3a522defa96ea87a305a3a42f0..b357b3facf9bb4ab46070d7751cbad28cb58f517 100644 (file)
@@ -12,7 +12,7 @@
 // in the type of `p` includes the points after `&v[0]` up to (but not
 // including) the call to `use_x`. The `else` branch is not included.
 
-// compile-flags:-Znll -Zborrowck=mir
+// compile-flags:-Zborrowck=mir
 // compile-pass
 
 #![allow(warnings)]
index e5478e39fecca9e3dddf2a394371d48ea55d8237..513609316311a3e567bd1e7e7b86c36638b5e1bd 100644 (file)
@@ -13,7 +13,7 @@
 // because of destructor. (Note that the stderr also identifies this
 // destructor in the error message.)
 
-// compile-flags:-Znll -Zborrowck=mir
+// compile-flags:-Zborrowck=mir
 
 #![allow(warnings)]
 #![feature(dropck_eyepatch)]
index e5944e75e424177fad5749b7c110b00e7930d19b..728c84695eacf0e3117e8246a75ebb12b18a2c19 100644 (file)
@@ -13,7 +13,7 @@
 // a variety of errors from the older, AST-based machinery (notably
 // borrowck), and then we get the NLL error at the end.
 
-// compile-flags:-Znll -Zborrowck=compare
+// compile-flags:-Zborrowck=compare
 
 struct Map {
 }
index d4df2a01c8143e97a6c4a30df74c8d30be74e158..5538eca362974acc261c0e35fee9d53e8a0297ce 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
+//compile-flags: -Z emit-end-regions -Zborrowck=mir
 
 
 #![allow(warnings)]
index 7e8a4e0ec95fc9e313f225da4128c1b6065c868f..ae815a5efe97c7f528ed287d9255156aabc68baf 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//compile-flags: -Z emit-end-regions -Zborrowck=mir -Z nll
+// compile-flags: -Z emit-end-regions -Zborrowck=mir
 // compile-pass
 
 #![allow(warnings)]
index 2eb90dca7026ec2182d728b9d2c6e8ed7c2f0970..00d146e0f02d6b672099fe1a164e6a378d140586 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
+//compile-flags: -Z emit-end-regions -Zborrowck=mir
 
 #![allow(warnings)]
 
index f639d8f243f1423cfeb124a4bdd3267cd6f49b50..cd46014a7f5ca45dfbd2c1ee533f41c9c43ac9ef 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
+//compile-flags: -Z emit-end-regions -Zborrowck=mir
 
 #![allow(warnings)]
 
index c2cc479d28e3e78a12a69a2c098ad34449d71378..9a3aca346208d72d4b330b4f40f6b51c60abca63 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
+//compile-flags: -Z emit-end-regions -Zborrowck=mir
 
 #![allow(warnings)]
 
index 1515911fe870eb777a47e635fb7ee90e59f4f955..c1abcb434e68f8486cfdcd8742316265ec94266c 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll -Zborrowck=mir
+// compile-flags:-Zborrowck=mir
 // compile-pass
 
 #![feature(rustc_attrs)]
index 571bd9fd76e86eb011759b94af1a452c73105a34..f21127064d4c2ee1880b2e22300242ea85d55fa8 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
 
@@ -19,7 +19,7 @@ impl<'a, T> Foo<'a> for T { }
 
 fn foo<'a, T>(x: &T) -> impl Foo<'a> {
     x
-        //~^ WARNING not reporting region error due to -Znll
+        //~^ WARNING not reporting region error due to nll
         //~| ERROR explicit lifetime required in the type of `x` [E0621]
 }
 
index 92e4f72da3a10ddb0b0ae837cce397de916c10ef..f836960a28cf372d4b492945dd41ab6fcdb1deb7 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/impl-trait-captures.rs:21:5
    |
 LL |     x
index 2e0671f1a51e84a0b1dec72ef66f33d20164b24c..182e11da082f8d367afccd1b33a8e7784caf196a 100644 (file)
@@ -8,14 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
 
 use std::fmt::Debug;
 
 fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
 where
     T: Debug,
 {
@@ -31,7 +31,7 @@ fn correct_region<'a, T>(x: Box<T>) -> impl Debug + 'a
 }
 
 fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
 where
     T: 'b + Debug,
 {
index 2b90d53774e6515df02bb16b962063ead42c0a6c..50b80282e6241daae24f6a5e1093ab0344359f4f 100644 (file)
@@ -1,10 +1,10 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/impl-trait-outlives.rs:17:35
    |
 LL | fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a
    |                                   ^^^^^^^^^^^^^^^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/impl-trait-outlives.rs:33:42
    |
 LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
index 0ec6d7b74ad5add6c7f9948d3d2babe23347e9c2..d8f077467d9fcfca2bb4f030aa91974c7a8ec8df 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 // Test that we can deduce when projections like `T::Item` outlive the
 // function body. Test that this does not imply that `T: 'a` holds.
@@ -43,7 +43,7 @@ fn invoke1<'a, T>(x: Cell<&'a Option<T>>)
 #[rustc_errors]
 fn generic2<T: Iterator>(value: T) {
     twice(value, |value_ref, item| invoke2(value_ref, item));
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR the parameter type `T` may not live long enough
 }
 
index fa53967ed3aca652e207e6b04112f3380d4a9000..0a2bd3247655ae019783391c7b618567e64ffd21 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-implied-bounds.rs:45:36
    |
 LL |     twice(value, |value_ref, item| invoke2(value_ref, item));
index 0493bd1ea0d9cce01b3602e5332330e275f8cdaf..7b3ed6a94fcbb642951a69d156517a304f03c3fd 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 // Tests closures that propagate an outlives relationship to their
 // creator where the subject is a projection with no regions (`<T as
@@ -34,7 +34,7 @@ fn no_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a>
     T: Iterator,
 {
     with_signature(x, |mut y| Box::new(y.next()))
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR the associated type `<T as std::iter::Iterator>::Item` may not live long enough
 }
 
@@ -52,7 +52,7 @@ fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a>
     T: 'b + Iterator,
 {
     with_signature(x, |mut y| Box::new(y.next()))
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR the associated type `<T as std::iter::Iterator>::Item` may not live long enough
 }
 
index bcdf984f65a8a8db6889a79cd8401da26dcb23c3..0efbbdff12a3f25627b881adbf3d6f67d8821da6 100644 (file)
@@ -1,10 +1,10 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-no-regions-closure.rs:36:31
    |
 LL |     with_signature(x, |mut y| Box::new(y.next()))
    |                               ^^^^^^^^^^^^^^^^^^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-no-regions-closure.rs:54:31
    |
 LL |     with_signature(x, |mut y| Box::new(y.next()))
index 5f2e84e247a3c925911b708fabe438d96c73685c..32b73a51e11a527c198893dd30b74ad114270e53 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
 #![feature(dyn_trait)]
@@ -22,7 +22,7 @@ fn no_region<'a, T>(mut x: T) -> Box<dyn Anything + 'a>
     T: Iterator,
 {
     Box::new(x.next())
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| the associated type `<T as std::iter::Iterator>::Item` may not live long enough
 }
 
@@ -38,7 +38,7 @@ fn wrong_region<'a, 'b, T>(mut x: T) -> Box<dyn Anything + 'a>
     T: 'b + Iterator,
 {
     Box::new(x.next())
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| the associated type `<T as std::iter::Iterator>::Item` may not live long enough
 }
 
index 95851e7edc70c62bfb2ba2c1f0c13f177f84f5cf..b2c5f28268db893382fbc78a9741a9cfe5e8c15e 100644 (file)
@@ -1,10 +1,10 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-no-regions-fn.rs:24:5
    |
 LL |     Box::new(x.next())
    |     ^^^^^^^^^^^^^^^^^^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-no-regions-fn.rs:40:5
    |
 LL |     Box::new(x.next())
index 9a5e04deddfc92ce5a20265c30446027c0047c49..cfe2880bfed476795ff5c84470c3f70444de5362 100644 (file)
@@ -22,7 +22,7 @@
 //
 // Ensuring that both `T: 'a` and `'b: 'a` holds does work (`elements_outlive`).
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
 #![feature(dyn_trait)]
@@ -54,7 +54,7 @@ fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
     T: Anything<'b>,
 {
     with_signature(cell, t, |cell, t| require(cell, t));
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR the parameter type `T` may not live long enough
     //~| ERROR does not outlive free region
 }
@@ -66,7 +66,7 @@ fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
     'a: 'a,
 {
     with_signature(cell, t, |cell, t| require(cell, t));
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR the parameter type `T` may not live long enough
     //~| ERROR does not outlive free region
 }
@@ -88,7 +88,7 @@ fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
     // can do better here with a more involved verification step.
 
     with_signature(cell, t, |cell, t| require(cell, t));
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR the parameter type `T` may not live long enough
     //~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)`
 }
index aa45cf187010625eeb1ed76697e1c560eae44054..0d5a2dc7c559855b5138e8e9f2b3767bbe0fe48b 100644 (file)
@@ -1,16 +1,16 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-one-region-closure.rs:56:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-one-region-closure.rs:68:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-one-region-closure.rs:90:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
index 232025b57355cf98f5037d52e371b6e1e1358f90..16e91f2708fe94495627d0422a670af279e32d78 100644 (file)
@@ -14,7 +14,7 @@
 // case, the best way to satisfy the trait bound is to show that `'b:
 // 'a`, which can be done in various ways.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
 #![feature(dyn_trait)]
@@ -46,7 +46,7 @@ fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
     T: Anything<'b>,
 {
     with_signature(cell, t, |cell, t| require(cell, t));
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR does not outlive free region
 }
 
@@ -57,7 +57,7 @@ fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
     'a: 'a,
 {
     with_signature(cell, t, |cell, t| require(cell, t));
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR does not outlive free region
 }
 
@@ -78,7 +78,7 @@ fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
     // can do better here with a more involved verification step.
 
     with_signature(cell, t, |cell, t| require(cell, t));
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR does not outlive free region
 }
 
index 7a8010ad8e0ea94f7c2d8503df2e2a95b312f4b7..d4aca8380b469f2812d143a79db70f17cf7a4932 100644 (file)
@@ -1,16 +1,16 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-one-region-trait-bound-closure.rs:48:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-one-region-trait-bound-closure.rs:59:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-one-region-trait-bound-closure.rs:80:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
index a1bdd1b89f9a96c06e9eab8daa8e6d8a0135efce..0d42636c844a55acfbe54bc65a8394aa5b7cc3ce 100644 (file)
@@ -12,7 +12,7 @@
 // outlive `'static`. In this case, we don't get any errors, and in fact
 // we don't even propagate constraints from the closures to the callers.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 // compile-pass
 
 #![allow(warnings)]
index e3cee00ed4eb3b7539928eb4bdfb31403fa13d10..7c8ef140a29074296ec8cb6f885e12a343fd8090 100644 (file)
@@ -15,7 +15,7 @@
 // the trait bound, and hence we propagate it to the caller as a type
 // test.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
 #![feature(dyn_trait)]
@@ -47,7 +47,7 @@ fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
     T: Anything<'b, 'c>,
 {
     with_signature(cell, t, |cell, t| require(cell, t));
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may not live long enough
 }
 
@@ -58,7 +58,7 @@ fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
     'a: 'a,
 {
     with_signature(cell, t, |cell, t| require(cell, t));
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
 }
 
@@ -79,7 +79,7 @@ fn projection_outlives<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
     // can do better here with a more involved verification step.
 
     with_signature(cell, t, |cell, t| require(cell, t));
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
 }
 
@@ -107,7 +107,7 @@ fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
     T: Anything<'b, 'b>,
 {
     with_signature(cell, t, |cell, t| require(cell, t));
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR does not outlive free region
 }
 
index c7cbdaec3395c18174a963744b5a77e2c66ee992..7e36e467e4eba32ac700b48afea06ddae3016521 100644 (file)
@@ -1,22 +1,22 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-two-region-trait-bound-closure.rs:49:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-two-region-trait-bound-closure.rs:60:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-two-region-trait-bound-closure.rs:81:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
    |                                       ^^^^^^^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/projection-two-region-trait-bound-closure.rs:109:39
    |
 LL |     with_signature(cell, t, |cell, t| require(cell, t));
index 423747a6bd6cbb927aa271f8d9739d93607ec1c4..80b42c29563f1b5fb579a174117817032412f924 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
 #![feature(dyn_trait)]
index 997cc57cfa28c48269ed8fc1bedd01df7c10acd1..c8feaddff9382ddf2d335c5e1954445256690ed4 100644 (file)
@@ -1,16 +1,16 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/ty-param-closure-approximate-lower-bound.rs:35:31
    |
 LL |     twice(cell, value, |a, b| invoke(a, b));
    |                               ^^^^^^^^^^^^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/ty-param-closure-approximate-lower-bound.rs:43:31
    |
 LL |     twice(cell, value, |a, b| invoke(a, b));
    |                               ^^^^^^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/ty-param-closure-approximate-lower-bound.rs:43:31
    |
 LL |     twice(cell, value, |a, b| invoke(a, b));
index 95a483b3c355d00058fe1fd36f9c1cb65949c6ef..50763a1d5080808c6572da682d43073cbcf30cdf 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
 #![feature(dyn_trait)]
@@ -35,7 +35,7 @@ fn no_region<'a, T>(x: Box<T>) -> Box<dyn Debug + 'a>
     // `'a` (and subsequently reports an error).
 
     with_signature(x, |y| y)
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR the parameter type `T` may not live long enough
 }
 
@@ -51,7 +51,7 @@ fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>
     T: 'b + Debug,
 {
     x
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR the parameter type `T` may not live long enough
 }
 
index ba08bc1ff7b43c3c513d8e94fe4763bc3abac49d..500595e0c5dcaf21e32d80fe80168cd661a86e94 100644 (file)
@@ -1,10 +1,10 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/ty-param-closure-outlives-from-return-type.rs:37:27
    |
 LL |     with_signature(x, |y| y)
    |                           ^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/ty-param-closure-outlives-from-return-type.rs:53:5
    |
 LL |     x
index 1149f250a46e2f53b7deacba724f8f295033eb40..b70fc2b2ec4b40d6f0ee38e911a7e06afd4716b8 100644 (file)
@@ -12,7 +12,7 @@
 // `correct_region` for an explanation of how this test is setup; it's
 // somewhat intricate.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 
 #![allow(warnings)]
 #![feature(dyn_trait)]
@@ -43,7 +43,7 @@ fn no_region<'a, T>(a: Cell<&'a ()>, b: T) {
         // function, there is no where clause *anywhere*, and hence we
         // get an error (but reported by the closure creator).
         require(&x, &y)
-        //~^ WARNING not reporting region error due to -Znll
+        //~^ WARNING not reporting region error due to nll
     })
 }
 
@@ -77,7 +77,7 @@ fn wrong_region<'a, 'b, T>(a: Cell<&'a ()>, b: T)
         //~^ ERROR the parameter type `T` may not live long enough
         // See `correct_region`
         require(&x, &y)
-        //~^ WARNING not reporting region error due to -Znll
+        //~^ WARNING not reporting region error due to nll
     })
 }
 
index fcdb0b0a4a9fea15bbf8034329a2a8220da120e7..4d8a66ba8e1c4cea182584b02fc2fda762a9383b 100644 (file)
@@ -1,10 +1,10 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/ty-param-closure-outlives-from-where-clause.rs:45:9
    |
 LL |         require(&x, &y)
    |         ^^^^^^^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/ty-param-closure-outlives-from-where-clause.rs:79:9
    |
 LL |         require(&x, &y)
@@ -19,7 +19,7 @@ LL | |         //~^ ERROR the parameter type `T` may not live long enough
 LL | |         //
 LL | |         // See `correct_region`, which explains the point of this
 ...  |
-LL | |         //~^ WARNING not reporting region error due to -Znll
+LL | |         //~^ WARNING not reporting region error due to nll
 LL | |     })
    | |_____^
    |
@@ -40,7 +40,7 @@ LL | |         //~^ ERROR the parameter type `T` may not live long enough
 LL | |         //
 LL | |         // See `correct_region`, which explains the point of this
 ...  |
-LL | |         //~^ WARNING not reporting region error due to -Znll
+LL | |         //~^ WARNING not reporting region error due to nll
 LL | |     })
    | |_____^
    |
@@ -109,7 +109,7 @@ LL |       with_signature(a, b, |x, y| {
 LL | |         //~^ ERROR the parameter type `T` may not live long enough
 LL | |         // See `correct_region`
 LL | |         require(&x, &y)
-LL | |         //~^ WARNING not reporting region error due to -Znll
+LL | |         //~^ WARNING not reporting region error due to nll
 LL | |     })
    | |_____^
    |
@@ -130,7 +130,7 @@ LL |       with_signature(a, b, |x, y| {
 LL | |         //~^ ERROR the parameter type `T` may not live long enough
 LL | |         // See `correct_region`
 LL | |         require(&x, &y)
-LL | |         //~^ WARNING not reporting region error due to -Znll
+LL | |         //~^ WARNING not reporting region error due to nll
 LL | |     })
    | |_____^
    |
index e66c1853b64b9167e73a39b6e8c9f20d2c2ce0da..fb4ea63f8532cd9c24d9d63f52c3c0e40f03d6bd 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll -Zborrowck=mir
+// compile-flags:-Zborrowck=mir
 
 // Test that we assume that universal types like `T` outlive the
 // function body.
@@ -28,7 +28,7 @@ fn region_within_body<T>(t: T) {
 // Error here, because T: 'a is not satisfied.
 fn region_static<'a, T>(cell: Cell<&'a usize>, t: T) {
     outlives(cell, t)
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| ERROR the parameter type `T` may not live long enough
 }
 
index 34ed709a2730e0afae779688e78596601412e3e9..0596861e67b572b8bbf67e9b10a15d9d3c394bdf 100644 (file)
@@ -1,4 +1,4 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/ty-param-fn-body.rs:30:5
    |
 LL |     outlives(cell, t)
index aa3a03afa35cdbfd2acb818366c050389ad568d0..42d662e14193ccbce257bdb8ea6da923b8bd9366 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll -Zborrowck=mir
+// compile-flags:-Zborrowck=mir
 
 #![allow(warnings)]
 #![feature(dyn_trait)]
@@ -20,7 +20,7 @@ fn no_region<'a, T>(x: Box<T>) -> Box<Debug + 'a>
     T: Debug,
 {
     x
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| the parameter type `T` may not live long enough
 }
 
@@ -36,7 +36,7 @@ fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>
     T: 'b + Debug,
 {
     x
-    //~^ WARNING not reporting region error due to -Znll
+    //~^ WARNING not reporting region error due to nll
     //~| the parameter type `T` may not live long enough
 }
 
index 98ccfc52029ffbe9dc00f94049978379284411dd..0d09cac8c38513da8abfeffbcdd91ffbb5a16c6a 100644 (file)
@@ -1,10 +1,10 @@
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/ty-param-fn.rs:22:5
    |
 LL |     x
    |     ^
 
-warning: not reporting region error due to -Znll
+warning: not reporting region error due to nll
   --> $DIR/ty-param-fn.rs:38:5
    |
 LL |     x
index d4ae9b20e56ff21e15cc3dec621d9a7fffb742fd..51927d353ecc49ce12edd8bbabebd870ae716925 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll -Zborrowck=mir -Zverbose
+// compile-flags:-Zborrowck=mir -Zverbose
 // compile-pass
 
 // Test that we assume that universal types like `T` outlive the
index db0ac9279046ca8403f35103e4e98471460c2c39..f394a60ad9ffc0af2155c0931079eb5a178f5f39 100644 (file)
@@ -1686,7 +1686,7 @@ fn make_compile_args(&self, input_file: &Path, output_file: TargetLocation) -> C
 
         match self.config.compare_mode {
             Some(CompareMode::Nll) => {
-                rustc.args(&["-Znll", "-Zborrowck=mir", "-Ztwo-phase-borrows"]);
+                rustc.args(&["-Zborrowck=mir", "-Ztwo-phase-borrows"]);
             },
             None => {},
         }