Disable some nice region errors in NLL mode.
This commit is contained in:
parent
4b8089daf8
commit
37ba9ca334
39 changed files with 209 additions and 191 deletions
|
@ -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<ErrorReported> {
|
||||
// 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<ErrorReported> {
|
||||
self.try_report_named_anon_conflict()
|
||||
.or_else(|| self.try_report_anon_anon_conflict())
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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<Ref<i32>>, y: Ref<i32>) {
|
||||
| -------- -------- 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`.
|
||||
|
|
|
@ -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<Ref<'b, i32>>, 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`.
|
||||
|
|
|
@ -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<Ref<'b, i32>>, 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`.
|
||||
|
|
|
@ -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<Ref<'b, i32>>, 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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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<Ref<'a>>, 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`.
|
||||
|
|
|
@ -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<Ref<'a>>, 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`.
|
||||
|
|
|
@ -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<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.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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -4,14 +4,6 @@ warning: not reporting region error due to nll
|
|||
LL | y.push(z); //~ ERROR lifetime mismatch
|
||||
| ^
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $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...
|
||||
LL | y.push(z); //~ ERROR lifetime mismatch
|
||||
| ^^^^^^^^^ ...but data from `z` flows into `y` here
|
||||
|
||||
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
|
||||
|
|
||||
|
@ -20,7 +12,16 @@ LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
|
|||
LL | y.push(z); //~ ERROR lifetime mismatch
|
||||
| ^ cannot borrow 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) {
|
||||
| - - 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
|
||||
| ^^^^^^^^^ 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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -4,14 +4,6 @@ warning: not reporting region error due to nll
|
|||
LL | y.push(z); //~ ERROR lifetime mismatch
|
||||
| ^
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ex3-both-anon-regions-using-trait-objects.rs:11:3
|
||||
|
|
||||
LL | fn foo(x:Box<Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
|
||||
| --- --- these two types are declared with different lifetimes...
|
||||
LL | y.push(z); //~ ERROR lifetime mismatch
|
||||
| ^^^^^^^^^ ...but data from `z` flows into `y` here
|
||||
|
||||
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
|
||||
|
|
||||
|
@ -20,7 +12,16 @@ LL | fn foo(x:Box<Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
|
|||
LL | y.push(z); //~ ERROR lifetime mismatch
|
||||
| ^ cannot borrow as mutable
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/ex3-both-anon-regions-using-trait-objects.rs:11:3
|
||||
|
|
||||
LL | fn foo(x:Box<Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
|
||||
| - - 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
|
||||
| ^^^^^^^^^ 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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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() { }
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue