diff --git a/src/librustc/infer/error_reporting/nice_region_error/mod.rs b/src/librustc/infer/error_reporting/nice_region_error/mod.rs index f50c23b0aa752..ddeb291a13aa3 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/mod.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/mod.rs @@ -64,6 +64,12 @@ impl<'cx, 'gcx, 'tcx> NiceRegionError<'cx, 'gcx, 'tcx> { Self { tcx, error: None, regions: Some((span, sub, sup)), tables } } + pub fn try_report_from_nll(&self) -> Option { + // Due to the improved diagnostics returned by the MIR borrow checker, only a subset of + // the nice region errors are required when running under the MIR borrow checker. + self.try_report_named_anon_conflict() + } + pub fn try_report(&self) -> Option { self.try_report_named_anon_conflict() .or_else(|| self.try_report_anon_anon_conflict()) diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs index 8fbb4aafc1f67..c2670389e2d69 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs @@ -310,7 +310,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { if let (Some(f), Some(o)) = (self.to_error_region(fr), self.to_error_region(outlived_fr)) { let tables = infcx.tcx.typeck_tables_of(mir_def_id); let nice = NiceRegionError::new_from_span(infcx.tcx, span, o, f, Some(tables)); - if let Some(_error_reported) = nice.try_report() { + if let Some(_error_reported) = nice.try_report_from_nll() { return; } } 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 1a3dc76005db4..0efdd19df3c88 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 lifetime mismatch [E0623] + //~^ ERROR unsatisfied lifetime constraints //~| WARNING not reporting region error due to nll } 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 69f0f43af1342..92e7db8617344 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 lifetime mismatch [E0623] + //~^ ERROR unsatisfied lifetime constraints //~| WARNING not reporting region error due to nll } diff --git a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr index cd2ebc341ead1..c923e6610ce0f 100644 --- a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr @@ -18,15 +18,15 @@ LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime re | | | consider changing the type of `y` to `&'a u32` -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/mismatched.rs:16:46 | LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch - | ------- ------- ^ ...but data from `y` is returned here - | | - | this parameter and the return type are declared with different lifetimes... + | -- -- ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + | | | + | | lifetime `'b` defined here + | lifetime `'a` defined here error: aborting due to 2 previous errors -Some errors occurred: E0621, E0623. -For more information about an error, try `rustc --explain E0621`. +For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr index 71e9c34ac2b97..b6bf646132e39 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr @@ -4,17 +4,16 @@ warning: not reporting region error due to nll LL | if x > y { x } else { y } //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:21:12 | LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { - | ---- ------- - | | - | this parameter and the return type are declared with different lifetimes... + | -- - let's call the lifetime of this reference `'1` + | | + | lifetime `'a` defined here LL | LL | if x > y { x } else { y } //~ ERROR lifetime mismatch - | ^^^^^ ...but data from `x` is returned here + | ^^^^^ requires that `'1` must outlive `'a` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr index 6c16d6a608ec8..93eac05e8d2c7 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr @@ -4,17 +4,16 @@ warning: not reporting region error due to nll LL | x //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:18:5 | LL | fn foo<'a>(&self, x: &'a i32) -> &i32 { - | ------- ---- - | | - | this parameter and the return type are declared with different lifetimes... + | -- - let's call the lifetime of this reference `'1` + | | + | lifetime `'a` defined here LL | LL | x //~ ERROR lifetime mismatch - | ^ ...but data from `x` is returned here + | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr index 6dc96ace4d0d3..c5b4fd1934b28 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr @@ -4,17 +4,16 @@ warning: not reporting region error due to nll LL | if true { x } else { self } //~ ERROR lifetime mismatch | ^^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:18:9 | LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { - | ----- ------- - | | - | this parameter and the return type are declared with different lifetimes... + | -- - let's call the lifetime of this reference `'1` + | | + | lifetime `'a` defined here LL | LL | if true { x } else { self } //~ ERROR lifetime mismatch - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...but data from `self` is returned here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'1` must outlive `'a` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.nll.stderr b/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.nll.stderr index 4b4fdde940f7e..614034794bd60 100644 --- a/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.push(y); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex2b-push-no-existing-names.rs:16:5 | LL | fn foo(x: &mut Vec>, y: Ref) { - | -------- -------- these two types are declared with different lifetimes... + | -------- -------- lifetime `'1` appears in this type + | | + | lifetime `'2` appears in this type LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex2c-push-inference-variable.nll.stderr b/src/test/ui/lifetime-errors/ex2c-push-inference-variable.nll.stderr index f55fd291249c6..c34278b4d9fa1 100644 --- a/src/test/ui/lifetime-errors/ex2c-push-inference-variable.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2c-push-inference-variable.nll.stderr @@ -4,15 +4,16 @@ warning: not reporting region error due to nll LL | let z = Ref { data: y.data }; | ^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex2c-push-inference-variable.rs:17:5 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { - | ------------ ------------ these two types are declared with different lifetimes... + | -- -- lifetime `'c` defined here + | | + | lifetime `'b` defined here LL | let z = Ref { data: y.data }; LL | x.push(z); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'c` must outlive `'b` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr b/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr index 85b5f3e890008..3097d18e86c67 100644 --- a/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr @@ -4,15 +4,16 @@ warning: not reporting region error due to nll LL | let b = Ref { data: y.data }; | ^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex2d-push-inference-variable-2.rs:18:5 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { - | ------------ ------------ these two types are declared with different lifetimes... + | -- -- lifetime `'c` defined here + | | + | lifetime `'b` defined here ... LL | a.push(b); - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'c` must outlive `'b` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr b/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr index 7e5182a5d30c9..ce0e9be300698 100644 --- a/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr @@ -4,15 +4,16 @@ warning: not reporting region error due to nll LL | let b = Ref { data: y.data }; | ^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex2e-push-inference-variable-3.rs:18:5 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { - | ------------ ------------ these two types are declared with different lifetimes... + | -- -- lifetime `'c` defined here + | | + | lifetime `'b` defined here ... LL | Vec::push(a, b); - | ^^^^^^^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^^^^^^^ argument requires that `'c` must outlive `'b` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr index 36317c4570b98..c7f1a0ede3c1c 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | *v = x; //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-2.rs:12:5 | LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) { - | --- --- these two types are declared with different lifetimes... + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | *v = x; //~ ERROR lifetime mismatch - | ^^^^^^ ...but data from `x` flows here + | ^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr index c43c4ce3a0c21..09980e44c52d6 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr @@ -10,22 +10,25 @@ warning: not reporting region error due to nll LL | z.push((x,y)); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-3.rs:12:5 | LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { - | --- --- these two types are declared with different lifetimes... + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | z.push((x,y)); //~ ERROR lifetime mismatch - | ^^^^^^^^^^^^^ ...but data flows into `z` here + | ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-3.rs:12:5 | LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { - | --- --- these two types are declared with different lifetimes... + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | z.push((x,y)); //~ ERROR lifetime mismatch - | ^^^^^^^^^^^^^ ...but data flows into `z` here + | ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr index 191389b7706e1..2829fbcd32a1b 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.b = y.b; //~ ERROR lifetime mismatch | ^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:16:5 | LL | fn foo(mut x: Ref, y: Ref) { - | --- --- these two types are declared with different lifetimes... + | --- --- lifetime `'1` appears in this type + | | + | lifetime `'2` appears in this type LL | x.b = y.b; //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr index 159367cc9d2a6..8171ee758b066 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr @@ -4,16 +4,16 @@ warning: not reporting region error due to nll LL | x.a = x.b; //~ ERROR lifetime mismatch | ^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:16:5 | LL | fn foo(mut x: Ref) { | --- | | - | this type is declared with multiple lifetimes... + | lifetime `'1` appears in this type + | lifetime `'2` appears in this type LL | x.a = x.b; //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data with one lifetime flows into the other here + | ^^^^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr index 3bbcbdd6681fd..99b64605baec1 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr @@ -4,16 +4,16 @@ warning: not reporting region error due to nll LL | x.a = x.b; //~ ERROR lifetime mismatch | ^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-both-are-structs-4.rs:16:5 | LL | fn foo(mut x: Ref) { | --- | | - | this type is declared with multiple lifetimes... + | lifetime `'1` appears in this type + | lifetime `'2` appears in this type LL | x.a = x.b; //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data with one lifetime flows into the other here + | ^^^^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr index 2a5729952e33d..aed0dcc1a67ea 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr @@ -4,15 +4,16 @@ warning: not reporting region error due to nll LL | x.push(y); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:18:5 | LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) - | ------- ------- these two types are declared with different lifetimes... + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here ... LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'b` must outlive `'a` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr index 6efc8d3da0677..7790d37d1c40d 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.push(y); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:15:5 | LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) { - | ------- ------- these two types are declared with different lifetimes... + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'b` must outlive `'a` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr index 0f555020822cb..c9542d3106979 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.push(y); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-both-are-structs.rs:15:5 | LL | fn foo(mut x: Vec, y: Ref) { - | --- --- these two types are declared with different lifetimes... + | --- --- lifetime `'1` appears in this type + | | + | lifetime `'2` appears in this type LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr index 4400644e7fb65..459a93813a8ca 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.push(y); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-latebound-regions.rs:12:5 | LL | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { - | ------ ------ these two types are declared with different lifetimes... + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'b` must outlive `'a` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr index 93f2837c0fc11..459796760e1b4 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr @@ -4,15 +4,15 @@ warning: not reporting region error due to nll LL | y = x.b; //~ ERROR lifetime mismatch | ^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:5 | LL | fn foo(mut x: Ref, y: &u32) { - | --- ---- + | --- - let's call the lifetime of this reference `'2` | | - | these two types are declared with different lifetimes... + | lifetime `'1` appears in this type LL | y = x.b; //~ ERROR lifetime mismatch - | ^^^^^^^ ...but data from `x` flows into `y` here + | ^^^^^^^ requires that `'1` must outlive `'2` error[E0384]: cannot assign to immutable argument `y` --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:5 @@ -24,5 +24,4 @@ LL | y = x.b; //~ ERROR lifetime mismatch error: aborting due to 2 previous errors -Some errors occurred: E0384, E0623. -For more information about an error, try `rustc --explain E0384`. +For more information about this error, try `rustc --explain E0384`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr index e7fb67f117f88..5fc1755ed390a 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | y.b = x; //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:14:5 | LL | fn foo(mut y: Ref, x: &u32) { - | --- ---- these two types are declared with different lifetimes... + | --- - let's call the lifetime of this reference `'1` + | | + | lifetime `'2` appears in this type LL | y.b = x; //~ ERROR lifetime mismatch - | ^^^^^^^ ...but data from `x` flows into `y` here + | ^^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr index af9e3a42664cf..835f95880a744 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | y.b = x; //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:14:5 | LL | fn foo(mut y: Ref, x: &u32) { - | --- ---- these two types are declared with different lifetimes... + | --- - let's call the lifetime of this reference `'1` + | | + | lifetime `'2` appears in this type LL | y.b = x; //~ ERROR lifetime mismatch - | ^^^^^^^ ...but data from `x` flows into `y` here + | ^^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr index 5437beaab6511..7aed5fe626f06 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.b = y; //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-one-is-struct.rs:17:5 | LL | fn foo(mut x: Ref, y: &u32) { - | --- ---- these two types are declared with different lifetimes... + | --- - let's call the lifetime of this reference `'1` + | | + | lifetime `'2` appears in this type LL | x.b = y; //~ ERROR lifetime mismatch - | ^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr index 42e1d42a32ccd..22581d9b0751f 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr @@ -4,16 +4,15 @@ warning: not reporting region error due to nll LL | x //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:17:5 | LL | fn foo<'a>(&self, x: &i32) -> &i32 { - | ---- ---- - | | - | this parameter and the return type are declared with different lifetimes... + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | x //~ ERROR lifetime mismatch - | ^ ...but data from `x` is returned here + | ^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr index 26b0488cfdc61..908526d439e8b 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr @@ -4,16 +4,15 @@ warning: not reporting region error due to nll LL | if true { x } else { self } //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-self-is-anon.rs:17:9 | LL | fn foo<'a>(&self, x: &Foo) -> &Foo { - | ---- ---- - | | - | this parameter and the return type are declared with different lifetimes... + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | if true { x } else { self } //~ ERROR lifetime mismatch - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...but data from `x` is returned here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr index a0aa1e28d9bc0..2829ec3500043 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr @@ -4,23 +4,24 @@ warning: not reporting region error due to nll LL | y.push(z); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable --> $DIR/ex3-both-anon-regions-using-fn-items.rs:11:3 | LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { - | --- --- these two types are declared with different lifetimes... + | - help: consider changing this to be mutable: `mut y` LL | y.push(z); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `z` flows into `y` here + | ^ cannot borrow as mutable -error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-using-fn-items.rs:11:3 | LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { - | - help: consider changing this to be mutable: `mut y` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | y.push(z); //~ ERROR lifetime mismatch - | ^ cannot borrow as mutable + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` error: aborting due to 2 previous errors -Some errors occurred: E0596, E0623. -For more information about an error, try `rustc --explain E0596`. +For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr index 5d4492701beb3..44d68df4b5590 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.push(y); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-using-impl-items.rs:15:9 | LL | fn foo(x: &mut Vec<&u8>, y: &u8) { - | --- --- these two types are declared with different lifetimes... + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr index 37b79cee72f75..5d3c6f38ad808 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr @@ -4,23 +4,24 @@ warning: not reporting region error due to nll LL | y.push(z); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:11:3 | LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { - | --- --- these two types are declared with different lifetimes... + | - help: consider changing this to be mutable: `mut y` LL | y.push(z); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `z` flows into `y` here + | ^ cannot borrow as mutable -error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:11:3 | LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { - | - help: consider changing this to be mutable: `mut y` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | y.push(z); //~ ERROR lifetime mismatch - | ^ cannot borrow as mutable + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` error: aborting due to 2 previous errors -Some errors occurred: E0596, E0623. -For more information about an error, try `rustc --explain E0596`. +For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions.nll.stderr index c11d81a4c13da..6460e5d687ff0 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.push(y); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions.rs:12:5 | LL | fn foo(x: &mut Vec<&u8>, y: &u8) { - | --- --- these two types are declared with different lifetimes... + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. 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 da8ce55162f37..d79be8b83c61f 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 lifetime mismatch + //~^ ERROR unsatisfied lifetime constraints // Only works if 'x: 'y: demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll 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 2704a32531466..fe67ca0293e06 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 | LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | _______________________________________________^ -LL | | //~^ ERROR lifetime mismatch +LL | | //~^ ERROR unsatisfied lifetime constraints LL | | LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll @@ -23,27 +23,12 @@ LL | | }); = note: number of external vids: 5 = note: where '_#1r: '_#2r -error[E0623]: lifetime mismatch - --> $DIR/propagate-approximated-ref.rs:53:5 - | -LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { - | ------- ------- - | | - | these two types are declared with different lifetimes... -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(x, y, x.get()) //~ WARNING not reporting region error due to nll -LL | | }); - | |______^ ...but data from `cell_a` flows into `cell_b` here - note: No external requirements --> $DIR/propagate-approximated-ref.rs:52:1 | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -LL | | //~^ ERROR lifetime mismatch +LL | | //~^ ERROR unsatisfied lifetime constraints LL | | ... | LL | | }); @@ -52,6 +37,20 @@ LL | | } | = note: defining type: DefId(0/0:6 ~ propagate_approximated_ref[317d]::supply[0]) with substs [] +error: unsatisfied lifetime constraints + --> $DIR/propagate-approximated-ref.rs:53:5 + | +LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | / establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { +LL | | //~^ ERROR unsatisfied lifetime constraints +LL | | +LL | | // Only works if 'x: 'y: +LL | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll +LL | | }); + | |______^ argument requires that `'a` must outlive `'b` + error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. 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 0449dc1d1a75c..bf24557398d16 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 lifetime mismatch + //~^ ERROR unsatisfied lifetime constraints // Only works if 'x: 'y: demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to nll 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 3cd9e9dd5b008..ed1fc6e1a712f 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 | LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { | _____________________________________________^ -LL | | //~^ ERROR lifetime mismatch +LL | | //~^ ERROR unsatisfied lifetime constraints LL | | LL | | // Only works if 'x: 'y: LL | | demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to nll @@ -23,27 +23,12 @@ LL | | }); = note: number of external vids: 5 = note: where '_#1r: '_#2r -error[E0623]: lifetime mismatch - --> $DIR/propagate-approximated-val.rs:46:5 - | -LL | fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { - | ------- ------- - | | - | these two types are declared with different lifetimes... -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 nll -LL | | }); - | |______^ ...but data from `cell_a` flows into `cell_b` here - note: No external requirements --> $DIR/propagate-approximated-val.rs:45:1 | LL | / fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { -LL | | //~^ ERROR lifetime mismatch +LL | | //~^ ERROR unsatisfied lifetime constraints LL | | ... | LL | | }); @@ -52,6 +37,20 @@ LL | | } | = note: defining type: DefId(0/0:6 ~ propagate_approximated_val[317d]::test[0]) with substs [] +error: unsatisfied lifetime constraints + --> $DIR/propagate-approximated-val.rs:46:5 + | +LL | fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | / establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { +LL | | //~^ ERROR unsatisfied lifetime constraints +LL | | +LL | | // Only works if 'x: 'y: +LL | | demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to nll +LL | | }); + | |______^ argument requires that `'a` must outlive `'b` + error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. 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 8598668bef50e..a883e7b199473 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 nll - //~| ERROR lifetime mismatch + //~| ERROR unsatisfied lifetime constraints } 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 415aefdeee947..cf3f4df19ae52 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,16 +4,15 @@ warning: not reporting region error due to nll LL | &*x | ^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/region-lbr1-does-not-outlive-ebr2.rs:19:5 | LL | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 { - | ------- ------- - | | - | this parameter and the return type are declared with different lifetimes... + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here LL | &*x - | ^^^ ...but data from `x` is returned here + | ^^^ requires that `'a` must outlive `'b` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/nll/issue-52113.rs b/src/test/ui/nll/issue-52113.rs index 1c509c5d22461..e484c249d84a5 100644 --- a/src/test/ui/nll/issue-52113.rs +++ b/src/test/ui/nll/issue-52113.rs @@ -40,7 +40,7 @@ fn produce3<'a, 'b: 'a>(data: &'a mut Vec<&'a u32>, value: &'b u32) -> impl Bazi } fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> impl Bazinga + 'b { - let x = move || { //~ ERROR lifetime mismatch + let x = move || { //~ ERROR unsatisfied lifetime constraints let value: &'a u32 = value; data.push(value); }; diff --git a/src/test/ui/nll/issue-52113.stderr b/src/test/ui/nll/issue-52113.stderr index 4a7c10c3f1af8..b21539361e66f 100644 --- a/src/test/ui/nll/issue-52113.stderr +++ b/src/test/ui/nll/issue-52113.stderr @@ -1,11 +1,12 @@ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/issue-52113.rs:43:9 | LL | fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> impl Bazinga + 'b { - | -------------------- ------- these two types are declared with different lifetimes... -LL | let x = move || { //~ ERROR lifetime mismatch - | ^ ...but data from `value` flows into `data` here + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | let x = move || { //~ ERROR unsatisfied lifetime constraints + | ^ requires that `'a` must outlive `'b` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`.