diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index aabe4057685..1d5ecd1483a 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -78,7 +78,7 @@ mod note; mod need_type_info; -mod nice_region_error; +pub mod nice_region_error; impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn note_and_explain_region(self, diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs index 5e921cc330d..a6fcbdea959 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs @@ -15,11 +15,13 @@ use rustc::infer::NLLRegionVariableOrigin; use rustc::infer::RegionObligation; use rustc::infer::RegionVariableOrigin; use rustc::infer::SubregionOrigin; +use rustc::infer::error_reporting::nice_region_error::NiceRegionError; use rustc::infer::region_constraints::{GenericKind, VarOrigins}; use rustc::mir::{ClosureOutlivesRequirement, ClosureOutlivesSubject, ClosureRegionRequirements, Local, Location, Mir}; use rustc::traits::ObligationCause; use rustc::ty::{self, RegionVid, Ty, TypeFoldable}; +use rustc::util::common::ErrorReported; use rustc_data_structures::indexed_vec::IndexVec; use rustc_errors::DiagnosticBuilder; use std::fmt; @@ -230,7 +232,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// `num_region_variables` valid inference variables; the first N /// of those will be constant regions representing the free /// regions defined in `universal_regions`. - pub fn new( + pub(crate) fn new( var_origins: VarOrigins, universal_regions: UniversalRegions<'tcx>, mir: &Mir<'tcx>, @@ -430,7 +432,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { self.check_type_tests(infcx, mir, outlives_requirements.as_mut()); - self.check_universal_regions(infcx, mir, outlives_requirements.as_mut()); + self.check_universal_regions(infcx, mir, mir_def_id, outlives_requirements.as_mut()); let outlives_requirements = outlives_requirements.unwrap_or(vec![]); @@ -807,6 +809,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { &self, infcx: &InferCtxt<'_, 'gcx, 'tcx>, mir: &Mir<'tcx>, + mir_def_id: DefId, mut propagated_outlives_requirements: Option<&mut Vec>>, ) { // The universal regions are always found in a prefix of the @@ -819,7 +822,13 @@ impl<'tcx> RegionInferenceContext<'tcx> { // they did not grow too large, accumulating any requirements // for our caller into the `outlives_requirements` vector. for (fr, _) in universal_definitions { - self.check_universal_region(infcx, mir, fr, &mut propagated_outlives_requirements); + self.check_universal_region( + infcx, + mir, + mir_def_id, + fr, + &mut propagated_outlives_requirements, + ); } } @@ -835,6 +844,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { &self, infcx: &InferCtxt<'_, 'gcx, 'tcx>, mir: &Mir<'tcx>, + mir_def_id: DefId, longer_fr: RegionVid, propagated_outlives_requirements: &mut Option<&mut Vec>>, ) { @@ -891,7 +901,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { // Note: in this case, we use the unapproximated regions // to report the error. This gives better error messages // in some cases. - self.report_error(infcx, mir, longer_fr, shorter_fr, blame_span); + self.report_error(infcx, mir, mir_def_id, longer_fr, shorter_fr, blame_span); } } @@ -907,18 +917,30 @@ impl<'tcx> RegionInferenceContext<'tcx> { &self, infcx: &InferCtxt<'_, '_, 'tcx>, mir: &Mir<'tcx>, + mir_def_id: DefId, fr: RegionVid, outlived_fr: RegionVid, blame_span: Span, ) { // Obviously uncool error reporting. - let fr_string = match self.definitions[fr].external_name { + let fr_name = self.definitions[fr].external_name; + let outlived_fr_name = self.definitions[outlived_fr].external_name; + + if let (Some(f), Some(o)) = (fr_name, outlived_fr_name) { + let tables = infcx.tcx.typeck_tables_of(mir_def_id); + let nice = NiceRegionError::new(infcx.tcx, blame_span, o, f, Some(tables)); + if let Some(ErrorReported) = nice.try_report() { + return; + } + } + + let fr_string = match fr_name { Some(r) => format!("free region `{}`", r), None => format!("free region `{:?}`", fr), }; - let outlived_fr_string = match self.definitions[outlived_fr].external_name { + let outlived_fr_string = match outlived_fr_name { Some(r) => format!("free region `{}`", r), None => format!("free region `{:?}`", outlived_fr), }; diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/nll/universal_regions.rs index 6eca1b0a146..45604d52958 100644 --- a/src/librustc_mir/borrow_check/nll/universal_regions.rs +++ b/src/librustc_mir/borrow_check/nll/universal_regions.rs @@ -445,7 +445,7 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> { let defining_ty = self.defining_ty(); debug!("build: defining_ty={:?}", defining_ty); - let indices = self.compute_indices(fr_static, defining_ty); + let mut indices = self.compute_indices(fr_static, defining_ty); debug!("build: indices={:?}", indices); let bound_inputs_and_output = self.compute_inputs_and_output(&indices, defining_ty); @@ -453,8 +453,12 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> { // "Liberate" the late-bound regions. These correspond to // "local" free regions. let first_local_index = self.infcx.num_region_vars(); - let inputs_and_output = self.infcx - .replace_bound_regions_with_nll_infer_vars(FR, &bound_inputs_and_output); + let inputs_and_output = self.infcx.replace_bound_regions_with_nll_infer_vars( + FR, + self.mir_def_id, + &bound_inputs_and_output, + &mut indices, + ); let fr_fn_body = self.infcx.next_nll_region_var(FR).to_region_vid(); let num_universals = self.infcx.num_region_vars(); @@ -717,7 +721,7 @@ impl UniversalRegionRelations { } } -pub(crate) trait InferCtxtExt<'tcx> { +trait InferCtxtExt<'tcx> { fn replace_free_regions_with_nll_infer_vars( &self, origin: NLLRegionVariableOrigin, @@ -729,7 +733,9 @@ pub(crate) trait InferCtxtExt<'tcx> { fn replace_bound_regions_with_nll_infer_vars( &self, origin: NLLRegionVariableOrigin, + all_outlive_scope: DefId, value: &ty::Binder, + indices: &mut UniversalRegionIndices<'tcx>, ) -> T where T: TypeFoldable<'tcx>; @@ -752,18 +758,38 @@ impl<'cx, 'gcx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'gcx, 'tcx> { fn replace_bound_regions_with_nll_infer_vars( &self, origin: NLLRegionVariableOrigin, + all_outlive_scope: DefId, value: &ty::Binder, + indices: &mut UniversalRegionIndices<'tcx>, ) -> T where T: TypeFoldable<'tcx>, { - let (value, _map) = self.tcx - .replace_late_bound_regions(value, |_br| self.next_nll_region_var(origin)); + let (value, _map) = self.tcx.replace_late_bound_regions(value, |br| { + let liberated_region = self.tcx.mk_region(ty::ReFree(ty::FreeRegion { + scope: all_outlive_scope, + bound_region: br, + })); + let region_vid = self.next_nll_region_var(origin); + indices.insert_late_bound_region(liberated_region, region_vid.to_region_vid()); + region_vid + }); value } } impl<'tcx> UniversalRegionIndices<'tcx> { + /// Initially, the `UniversalRegionIndices` map contains only the + /// early-bound regions in scope. Once that is all setup, we come + /// in later and instantiate the late-bound regions, and then we + /// insert the `ReFree` version of those into the map as + /// well. These are used for error reporting. + fn insert_late_bound_region(&mut self, r: ty::Region<'tcx>, + vid: ty::RegionVid) + { + self.indices.insert(r, vid); + } + /// Converts `r` into a local inference variable: `r` can either /// by a `ReVar` (i.e., already a reference to an inference /// variable) or it can be `'static` or some early-bound diff --git a/src/test/compile-fail/mir_check_cast_reify.rs b/src/test/compile-fail/mir_check_cast_reify.rs index 1736aea2d6d..f6ad2820d17 100644 --- a/src/test/compile-fail/mir_check_cast_reify.rs +++ b/src/test/compile-fail/mir_check_cast_reify.rs @@ -45,7 +45,7 @@ fn bar<'a>(x: &'a u32) -> &'static u32 { // as part of checking the `ReifyFnPointer`. let f: fn(_) -> _ = foo; //~^ WARNING not reporting region error due to -Znll - //~| ERROR free region `'_#1r` does not outlive free region `'static` + //~| ERROR free region `'a` does not outlive free region `'static` f(x) } diff --git a/src/test/compile-fail/mir_check_cast_unsafe_fn.rs b/src/test/compile-fail/mir_check_cast_unsafe_fn.rs index 39eafa10040..c9b378dacd5 100644 --- a/src/test/compile-fail/mir_check_cast_unsafe_fn.rs +++ b/src/test/compile-fail/mir_check_cast_unsafe_fn.rs @@ -17,7 +17,7 @@ fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 { // in `g`. These are related via the `UnsafeFnPointer` cast. let g: unsafe fn(_) -> _ = f; //~^ WARNING not reporting region error due to -Znll - //~| ERROR free region `'_#1r` does not outlive free region `'static` + //~| ERROR free region `'a` does not outlive free region `'static` unsafe { g(input) } } diff --git a/src/test/compile-fail/mir_check_cast_unsize.rs b/src/test/compile-fail/mir_check_cast_unsize.rs index bc867047ab5..1df56793f73 100644 --- a/src/test/compile-fail/mir_check_cast_unsize.rs +++ b/src/test/compile-fail/mir_check_cast_unsize.rs @@ -16,7 +16,7 @@ use std::fmt::Debug; fn bar<'a>(x: &'a u32) -> &'static dyn Debug { - //~^ ERROR free region `'_#1r` does not outlive free region `'static` + //~^ ERROR free region `'a` does not outlive free region `'static` x //~^ WARNING not reporting region error due to -Znll } diff --git a/src/test/compile-fail/nll/where_clauses_in_functions.rs b/src/test/compile-fail/nll/where_clauses_in_functions.rs index a13360aeca7..ecea8756903 100644 --- a/src/test/compile-fail/nll/where_clauses_in_functions.rs +++ b/src/test/compile-fail/nll/where_clauses_in_functions.rs @@ -21,7 +21,7 @@ where fn bar<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { foo(x, y) - //~^ ERROR free region `'_#1r` does not outlive free region `'_#2r` + //~^ ERROR lifetime mismatch [E0623] //~| WARNING not reporting region error due to -Znll } diff --git a/src/test/compile-fail/nll/where_clauses_in_structs.rs b/src/test/compile-fail/nll/where_clauses_in_structs.rs index 0c4fd5dead3..f1a6dc48e13 100644 --- a/src/test/compile-fail/nll/where_clauses_in_structs.rs +++ b/src/test/compile-fail/nll/where_clauses_in_structs.rs @@ -21,7 +21,7 @@ struct Foo<'a: 'b, 'b> { fn bar<'a, 'b>(x: Cell<&'a u32>, y: Cell<&'b u32>) { Foo { x, y }; - //~^ ERROR free region `'_#1r` does not outlive free region `'_#2r` + //~^ ERROR lifetime mismatch [E0623] //~| WARNING not reporting region error due to -Znll } diff --git a/src/test/compile-fail/regions-static-bound.rs b/src/test/compile-fail/regions-static-bound.rs index 678da45fce4..a217cc9ebfa 100644 --- a/src/test/compile-fail/regions-static-bound.rs +++ b/src/test/compile-fail/regions-static-bound.rs @@ -24,10 +24,10 @@ fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { fn error(u: &(), v: &()) { static_id(&u); //[ll]~ ERROR cannot infer an appropriate lifetime //[nll]~^ WARNING not reporting region error due to -Znll - //[nll]~| ERROR free region `'_#1r` does not outlive free region `'static` + //[nll]~| ERROR free region `` does not outlive free region `'static` static_id_indirect(&v); //[ll]~ ERROR cannot infer an appropriate lifetime //[nll]~^ WARNING not reporting region error due to -Znll - //[nll]~| ERROR free region `'_#2r` does not outlive free region `'static` + //[nll]~| ERROR free region `` does not outlive free region `'static` } fn main() {} diff --git a/src/test/ui/nll/closure-requirements/escape-argument-callee.rs b/src/test/ui/nll/closure-requirements/escape-argument-callee.rs index 1e34aaf1ea0..41c744fec6e 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument-callee.rs +++ b/src/test/ui/nll/closure-requirements/escape-argument-callee.rs @@ -34,7 +34,7 @@ fn test() { { let y = 22; let mut closure = expect_sig(|p, y| *p = y); - //~^ ERROR free region `'_#4r` does not outlive free region `'_#3r` + //~^ ERROR does not outlive free region //~| WARNING not reporting region error due to -Znll closure(&mut p, &y); } diff --git a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr index 2dfafd8f172..3bd02f308c8 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr @@ -4,7 +4,7 @@ warning: not reporting region error due to -Znll 36 | let mut closure = expect_sig(|p, y| *p = y); | ^ -error: free region `'_#4r` does not outlive free region `'_#3r` +error: free region `ReFree(DefId(0/1:9 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]), BrAnon(3))` does not outlive free region `ReFree(DefId(0/1:9 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]), BrAnon(2))` --> $DIR/escape-argument-callee.rs:36:45 | 36 | let mut closure = expect_sig(|p, y| *p = y); diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs index 50d7877de50..30a6dfc5b3e 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs @@ -54,7 +54,7 @@ fn supply<'a, 'b, 'c>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>, cell_c: Cell // Only works if 'x: 'y: let p = x.get(); //~^ WARN not reporting region error due to -Znll - //~| ERROR free region `'_#5r` does not outlive free region `'_#6r` + //~| ERROR does not outlive free region demand_y(x, y, p) }, ); diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr index f90bc7c175a..7e48c0fc584 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr @@ -4,7 +4,7 @@ warning: not reporting region error due to -Znll 55 | let p = x.get(); | ^^^^^^^ -error: free region `'_#5r` does not outlive free region `'_#6r` +error: free region `ReFree(DefId(0/1:20 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]), BrAnon(1))` does not outlive free region `ReFree(DefId(0/1:20 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]), BrAnon(2))` --> $DIR/propagate-approximated-fail-no-postdom.rs:55:17 | 55 | let p = x.get(); @@ -17,7 +17,7 @@ note: No external requirements 54 | | // Only works if 'x: 'y: 55 | | let p = x.get(); 56 | | //~^ WARN not reporting region error due to -Znll -57 | | //~| ERROR free region `'_#5r` does not outlive free region `'_#6r` +57 | | //~| ERROR does not outlive free region 58 | | demand_y(x, y, p) 59 | | }, | |_________^ diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs index 80a40581b89..91128035f3d 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs @@ -51,7 +51,7 @@ fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u3 #[rustc_regions] fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { - //~^ ERROR free region `'_#1r` does not outlive free region `'_#2r` + //~^ ERROR lifetime mismatch // Only works if 'x: 'y: demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr index 4bae29ad326..f9a6999243a 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -9,7 +9,7 @@ note: External requirements | 53 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | _______________________________________________^ -54 | | //~^ ERROR free region `'_#1r` does not outlive free region `'_#2r` +54 | | //~^ ERROR lifetime mismatch 55 | | 56 | | // Only works if 'x: 'y: 57 | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll @@ -23,18 +23,22 @@ note: External requirements = note: number of external vids: 3 = note: where '_#1r: '_#2r -error: free region `'_#1r` does not outlive free region `'_#2r` +error[E0623]: lifetime mismatch --> $DIR/propagate-approximated-ref.rs:53:29 | +52 | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + | ------- ------- + | | + | these two types are declared with different lifetimes... 53 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { - | ^^^^^^^ + | ^^^^^^^ ...but data from `cell_a` flows into `cell_b` here note: No external requirements --> $DIR/propagate-approximated-ref.rs:52:1 | 52 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { 53 | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -54 | | //~^ ERROR free region `'_#1r` does not outlive free region `'_#2r` +54 | | //~^ ERROR lifetime mismatch 55 | | ... | 58 | | }); diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs index 244929d71db..f210346a82a 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs @@ -31,7 +31,7 @@ fn case1() { foo(cell, |cell_a, cell_x| { //~^ WARNING not reporting region error due to -Znll cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure - //~^ ERROR free region `'_#2r` does not outlive free region `'_#1r` + //~^ ERROR does not outlive free region }) } diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index 45dc5d913ee..290377996c9 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -4,7 +4,7 @@ warning: not reporting region error due to -Znll 31 | foo(cell, |cell_a, cell_x| { | ^^^ -error: free region `'_#2r` does not outlive free region `'_#1r` +error: free region `ReFree(DefId(0/1:12 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]), BrAnon(1))` does not outlive free region `'_#1r` --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:33:9 | 33 | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure @@ -17,7 +17,7 @@ note: No external requirements | _______________^ 32 | | //~^ WARNING not reporting region error due to -Znll 33 | | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure -34 | | //~^ ERROR free region `'_#2r` does not outlive free region `'_#1r` +34 | | //~^ ERROR does not outlive free region 35 | | }) | |_____^ | diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs index 54007f0191d..c66472d5ce9 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs @@ -43,7 +43,7 @@ fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u3 #[rustc_regions] fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { - //~^ ERROR free region `'_#1r` does not outlive free region `ReStatic` + //~^ 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 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index 86b9fecb80e..13aedc408cf 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -9,7 +9,7 @@ note: External requirements | 45 | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | _______________________________________________^ -46 | | //~^ ERROR free region `'_#1r` does not outlive free region `ReStatic` +46 | | //~^ ERROR does not outlive free region 47 | | 48 | | // Only works if 'x: 'y: 49 | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll @@ -23,12 +23,12 @@ note: External requirements = note: number of external vids: 2 = note: where '_#1r: '_#0r -error: free region `'_#1r` does not outlive free region `ReStatic` +error: free region `ReFree(DefId(0/0:6 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]), BrNamed(crate0:DefIndex(1:16), 'a))` does not outlive free region `ReStatic` --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:45:47 | 45 | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | _______________________________________________^ -46 | | //~^ ERROR free region `'_#1r` does not outlive free region `ReStatic` +46 | | //~^ ERROR does not outlive free region 47 | | 48 | | // Only works if 'x: 'y: 49 | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll @@ -40,7 +40,7 @@ note: No external requirements | 44 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { 45 | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { -46 | | //~^ ERROR free region `'_#1r` does not outlive free region `ReStatic` +46 | | //~^ ERROR does not outlive free region 47 | | ... | 50 | | }); diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs index 68d51e2b7d1..f4011a0e533 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs @@ -46,7 +46,7 @@ fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u3 #[rustc_regions] fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { - //~^ ERROR free region `'_#1r` does not outlive free region `ReStatic` + //~^ 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 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index adc6b1ac595..947ed650e6b 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -9,7 +9,7 @@ note: External requirements | 48 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | _______________________________________________^ -49 | | //~^ ERROR free region `'_#1r` does not outlive free region `ReStatic` +49 | | //~^ ERROR does not outlive free region 50 | | // Only works if 'x: 'y: 51 | | demand_y(x, y, x.get()) 52 | | //~^ WARNING not reporting region error due to -Znll @@ -23,12 +23,12 @@ note: External requirements = note: number of external vids: 3 = note: where '_#1r: '_#0r -error: free region `'_#1r` does not outlive free region `ReStatic` +error: free region `ReFree(DefId(0/0:6 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]), BrNamed(crate0:DefIndex(1:16), 'a))` does not outlive free region `ReStatic` --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:48:47 | 48 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | _______________________________________________^ -49 | | //~^ ERROR free region `'_#1r` does not outlive free region `ReStatic` +49 | | //~^ ERROR does not outlive free region 50 | | // Only works if 'x: 'y: 51 | | demand_y(x, y, x.get()) 52 | | //~^ WARNING not reporting region error due to -Znll @@ -40,7 +40,7 @@ note: No external requirements | 47 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { 48 | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -49 | | //~^ ERROR free region `'_#1r` does not outlive free region `ReStatic` +49 | | //~^ ERROR does not outlive free region 50 | | // Only works if 'x: 'y: ... | 53 | | }); diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs index b4a759d5e70..d163f304ae5 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs @@ -44,7 +44,7 @@ fn demand_y<'x, 'y>(_outlives1: Cell<&&'x u32>, _outlives2: Cell<&'y &u32>, _y: #[rustc_regions] fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { - //~^ ERROR free region `'_#1r` does not outlive free region `'_#2r` + //~^ ERROR lifetime mismatch // Only works if 'x: 'y: demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to -Znll diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr index 43d61fdf1b5..64766296e65 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -9,7 +9,7 @@ note: External requirements | 46 | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { | _____________________________________________^ -47 | | //~^ ERROR free region `'_#1r` does not outlive free region `'_#2r` +47 | | //~^ ERROR lifetime mismatch 48 | | 49 | | // Only works if 'x: 'y: 50 | | demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to -Znll @@ -23,18 +23,22 @@ note: External requirements = note: number of external vids: 3 = note: where '_#1r: '_#2r -error: free region `'_#1r` does not outlive free region `'_#2r` +error[E0623]: lifetime mismatch --> $DIR/propagate-approximated-val.rs:46:29 | +45 | fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + | ------- ------- + | | + | these two types are declared with different lifetimes... 46 | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { - | ^^^^^^ + | ^^^^^^ ...but data from `cell_a` flows into `cell_b` here note: No external requirements --> $DIR/propagate-approximated-val.rs:45:1 | 45 | / fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { 46 | | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { -47 | | //~^ ERROR free region `'_#1r` does not outlive free region `'_#2r` +47 | | //~^ ERROR lifetime mismatch 48 | | ... | 51 | | }); diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs index 4bbdcc44944..eb512a3b9b1 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs @@ -46,7 +46,7 @@ fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { // Only works if 'x: 'y: demand_y(x, y, x.get()) //~^ WARN not reporting region error due to -Znll - //~| ERROR free region `'_#6r` does not outlive free region `'_#4r` + //~| ERROR does not outlive free region }); } diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr index f3c40c838fb..08dcfb042b5 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr @@ -4,7 +4,7 @@ warning: not reporting region error due to -Znll 47 | demand_y(x, y, x.get()) | ^^^^^^^^^^^^^^^^^^^^^^^ -error: free region `'_#6r` does not outlive free region `'_#4r` +error: free region `ReFree(DefId(0/1:18 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]), BrAnon(4))` does not outlive free region `ReFree(DefId(0/1:18 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]), BrAnon(2))` --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:47:18 | 47 | demand_y(x, y, x.get()) @@ -18,7 +18,7 @@ note: No external requirements 46 | | // Only works if 'x: 'y: 47 | | demand_y(x, y, x.get()) 48 | | //~^ WARN not reporting region error due to -Znll -49 | | //~| ERROR free region `'_#6r` does not outlive free region `'_#4r` +49 | | //~| ERROR does not outlive free region 50 | | }); | |_____^ | diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs index 69fad354792..93074246429 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs @@ -50,7 +50,7 @@ fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { // Only works if 'x: 'y: demand_y(x, y, x.get()) //~^ WARN not reporting region error due to -Znll - //~| ERROR free region `'_#5r` does not outlive free region `'_#7r` + //~| ERROR does not outlive free region }); } diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr index a66c2a78970..502f5650249 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr @@ -4,7 +4,7 @@ warning: not reporting region error due to -Znll 51 | demand_y(x, y, x.get()) | ^^^^^^^^^^^^^^^^^^^^^^^ -error: free region `'_#5r` does not outlive free region `'_#7r` +error: free region `ReFree(DefId(0/1:18 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]), BrAnon(2))` does not outlive free region `ReFree(DefId(0/1:18 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]), BrAnon(4))` --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:51:18 | 51 | demand_y(x, y, x.get()) @@ -18,7 +18,7 @@ note: No external requirements 50 | | // Only works if 'x: 'y: 51 | | demand_y(x, y, x.get()) 52 | | //~^ WARN not reporting region error due to -Znll -53 | | //~| ERROR free region `'_#5r` does not outlive free region `'_#7r` +53 | | //~| ERROR does not outlive free region 54 | | }); | |_____^ | diff --git a/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs b/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs index c61cf8a940f..3f56dfe5af4 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs +++ b/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs @@ -18,7 +18,7 @@ fn foo(x: &u32) -> &'static u32 { &*x //~^ WARN not reporting region error due to -Znll - //~| ERROR free region `'_#1r` does not outlive free region `ReStatic` + //~| ERROR does not outlive free region } fn main() { } diff --git a/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr b/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr index ef7ea923912..6648e38e7de 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr +++ b/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr @@ -4,7 +4,7 @@ warning: not reporting region error due to -Znll 19 | &*x | ^^^ -error: free region `'_#1r` does not outlive free region `ReStatic` +error: free region `ReFree(DefId(0/0:3 ~ region_lbr_anon_does_not_outlive_static[317d]::foo[0]), BrAnon(0))` does not outlive free region `ReStatic` --> $DIR/region-lbr-anon-does-not-outlive-static.rs:19:5 | 19 | &*x diff --git a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs index fcda5c5420b..a1be8e85185 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs +++ b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs @@ -18,7 +18,7 @@ fn foo<'a>(x: &'a u32) -> &'static u32 { &*x //~^ WARN not reporting region error due to -Znll - //~| ERROR free region `'_#1r` does not outlive free region `ReStatic` + //~| ERROR does not outlive free region } fn main() { } diff --git a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr index 6dcb8e7cf12..1edceba7b09 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr +++ b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr @@ -4,7 +4,7 @@ warning: not reporting region error due to -Znll 19 | &*x | ^^^ -error: free region `'_#1r` does not outlive free region `ReStatic` +error: free region `ReFree(DefId(0/0:3 ~ region_lbr_named_does_not_outlive_static[317d]::foo[0]), BrNamed(crate0:DefIndex(1:9), 'a))` does not outlive free region `ReStatic` --> $DIR/region-lbr-named-does-not-outlive-static.rs:19:5 | 19 | &*x diff --git a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs index c1e4dee0065..00b09e2ab21 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs +++ b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs @@ -18,7 +18,7 @@ fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 { &*x //~^ WARN not reporting region error due to -Znll - //~| ERROR free region `'_#1r` does not outlive free region `'_#2r` + //~| ERROR lifetime mismatch } fn main() { } diff --git a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr index c1b2f440309..efe0b73f195 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr +++ b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr @@ -4,11 +4,15 @@ warning: not reporting region error due to -Znll 19 | &*x | ^^^ -error: free region `'_#1r` does not outlive free region `'_#2r` +error[E0623]: lifetime mismatch --> $DIR/region-lbr1-does-not-outlive-ebr2.rs:19:5 | +18 | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 { + | ------- ------- + | | + | this parameter and the return type are declared with different lifetimes... 19 | &*x - | ^^^ + | ^^^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.rs b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.rs index 9314bbf9432..754df4f2c5d 100644 --- a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.rs +++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.rs @@ -20,7 +20,7 @@ fn test() { expect_sig(|a, b| b); // ought to return `a` //~^ WARN not reporting region error due to -Znll - //~| ERROR free region `'_#3r` does not outlive free region `'_#2r` + //~| ERROR does not outlive free region } fn expect_sig(f: F) -> F diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr index cb2b2e2f118..58a26e61e57 100644 --- a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr +++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr @@ -4,7 +4,7 @@ warning: not reporting region error due to -Znll 21 | expect_sig(|a, b| b); // ought to return `a` | ^ -error: free region `'_#3r` does not outlive free region `'_#2r` +error: free region `ReFree(DefId(0/1:9 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]), BrAnon(2))` does not outlive free region `ReFree(DefId(0/1:9 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]), BrAnon(1))` --> $DIR/return-wrong-bound-region.rs:21:23 | 21 | expect_sig(|a, b| b); // ought to return `a` @@ -27,7 +27,7 @@ note: No external requirements 20 | / fn test() { 21 | | expect_sig(|a, b| b); // ought to return `a` 22 | | //~^ WARN not reporting region error due to -Znll -23 | | //~| ERROR free region `'_#3r` does not outlive free region `'_#2r` +23 | | //~| ERROR does not outlive free region 24 | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/impl-trait-captures.rs b/src/test/ui/nll/ty-outlives/impl-trait-captures.rs index 896b74b579b..850cd1e7336 100644 --- a/src/test/ui/nll/ty-outlives/impl-trait-captures.rs +++ b/src/test/ui/nll/ty-outlives/impl-trait-captures.rs @@ -21,7 +21,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 - //~| ERROR free region `'_#2r` does not outlive free region `ReEarlyBound(0, 'a)` + //~| ERROR explicit lifetime required in the type of `x` [E0621] } fn main() {} diff --git a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr index 7de994dae88..4cfd12002e7 100644 --- a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr +++ b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr @@ -4,11 +4,13 @@ warning: not reporting region error due to -Znll 22 | x | ^ -error: free region `'_#2r` does not outlive free region `ReEarlyBound(0, 'a)` +error[E0621]: explicit lifetime required in the type of `x` --> $DIR/impl-trait-captures.rs:22:5 | +21 | fn foo<'a, T>(x: &T) -> impl Foo<'a> { + | - consider changing the type of `x` to `&ReEarlyBound(0, 'a) T` 22 | x - | ^ + | ^ lifetime `ReEarlyBound(0, 'a)` required error: aborting due to previous error diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs index e2a2d20d77d..5d68cc6a7a9 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs +++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs @@ -56,7 +56,7 @@ where with_signature(cell, t, |cell, t| require(cell, t)); //~^ WARNING not reporting region error due to -Znll //~| ERROR `T` does not outlive - //~| ERROR free region `ReEarlyBound(0, 'b)` does not outlive free region `'_#2r` + //~| ERROR does not outlive free region } #[rustc_regions] @@ -68,7 +68,7 @@ where with_signature(cell, t, |cell, t| require(cell, t)); //~^ WARNING not reporting region error due to -Znll //~| ERROR `T` does not outlive - //~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)` + //~| ERROR does not outlive free region } #[rustc_regions] diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr index cbd80d70bf9..73cfa0d18fa 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -89,7 +89,7 @@ error: `T` does not outlive `'_#5r` 56 | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: free region `ReEarlyBound(0, 'b)` does not outlive free region `'_#2r` +error: free region `ReEarlyBound(0, 'b)` does not outlive free region `ReFree(DefId(0/0:8 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:17), 'a))` --> $DIR/projection-one-region-closure.rs:56:20 | 56 | with_signature(cell, t, |cell, t| require(cell, t)); @@ -103,7 +103,7 @@ note: No external requirements 54 | | T: Anything<'b>, 55 | | { ... | -59 | | //~| ERROR free region `ReEarlyBound(0, 'b)` does not outlive free region `'_#2r` +59 | | //~| ERROR does not outlive free region 60 | | } | |_^ | @@ -132,7 +132,7 @@ note: No external requirements 65 | | T: Anything<'b>, 66 | | 'a: 'a, ... | -71 | | //~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)` +71 | | //~| ERROR does not outlive free region 72 | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs index e179927dfb0..232025b5735 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs @@ -47,7 +47,7 @@ where { with_signature(cell, t, |cell, t| require(cell, t)); //~^ WARNING not reporting region error due to -Znll - //~| ERROR free region `ReEarlyBound(0, 'b)` does not outlive free region `'_#2r` + //~| ERROR does not outlive free region } #[rustc_regions] @@ -58,7 +58,7 @@ where { with_signature(cell, t, |cell, t| require(cell, t)); //~^ WARNING not reporting region error due to -Znll - //~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)` + //~| ERROR does not outlive free region } #[rustc_regions] @@ -79,7 +79,7 @@ where with_signature(cell, t, |cell, t| require(cell, t)); //~^ WARNING not reporting region error due to -Znll - //~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)` + //~| ERROR does not outlive free region } #[rustc_regions] diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr index 1088ae846fe..5053b848695 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -94,7 +94,7 @@ note: External requirements = note: number of external vids: 3 = note: where '_#1r: '_#2r -error: free region `ReEarlyBound(0, 'b)` does not outlive free region `'_#2r` +error: free region `ReEarlyBound(0, 'b)` does not outlive free region `ReFree(DefId(0/0:8 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:17), 'a))` --> $DIR/projection-one-region-trait-bound-closure.rs:48:20 | 48 | with_signature(cell, t, |cell, t| require(cell, t)); @@ -108,7 +108,7 @@ note: No external requirements 46 | | T: Anything<'b>, 47 | | { ... | -50 | | //~| ERROR free region `ReEarlyBound(0, 'b)` does not outlive free region `'_#2r` +50 | | //~| ERROR does not outlive free region 51 | | } | |_^ | @@ -131,7 +131,7 @@ note: No external requirements 56 | | T: Anything<'b>, 57 | | 'a: 'a, ... | -61 | | //~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)` +61 | | //~| ERROR does not outlive free region 62 | | } | |_^ | @@ -155,7 +155,7 @@ note: No external requirements 67 | | T: Anything<'b>, 68 | | T::AssocType: 'a, ... | -82 | | //~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)` +82 | | //~| ERROR does not outlive free region 83 | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs index 42bfdfcf9f9..e129ac146fc 100644 --- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs +++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs @@ -108,7 +108,7 @@ where { with_signature(cell, t, |cell, t| require(cell, t)); //~^ WARNING not reporting region error due to -Znll - //~| ERROR free region `ReEarlyBound(0, 'b)` does not outlive free region `'_#2r` + //~| ERROR does not outlive free region } #[rustc_regions] diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index 5b708a0d7e6..b26cf2ca4cb 100644 --- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -264,7 +264,7 @@ note: No external requirements T ] -error: free region `ReEarlyBound(0, 'b)` does not outlive free region `'_#2r` +error: free region `ReEarlyBound(0, 'b)` does not outlive free region `ReFree(DefId(0/0:13 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]), BrNamed(crate0:DefIndex(1:44), 'a))` --> $DIR/projection-two-region-trait-bound-closure.rs:109:20 | 109 | with_signature(cell, t, |cell, t| require(cell, t)); @@ -278,7 +278,7 @@ note: No external requirements 107 | | T: Anything<'b, 'b>, 108 | | { ... | -111 | | //~| ERROR free region `ReEarlyBound(0, 'b)` does not outlive free region `'_#2r` +111 | | //~| ERROR does not outlive free region 112 | | } | |_^ |