diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:50 +0000 |
commit | 2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35 (patch) | |
tree | d325add32978dbdc1db975a438b3a77d571b1ab8 /tests/ui/nll | |
parent | Releasing progress-linux version 1.68.2+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.tar.xz rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.zip |
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
92 files changed, 652 insertions, 131 deletions
diff --git a/tests/ui/nll/borrowed-local-error.stderr b/tests/ui/nll/borrowed-local-error.stderr index d629caa43..1cca4077d 100644 --- a/tests/ui/nll/borrowed-local-error.stderr +++ b/tests/ui/nll/borrowed-local-error.stderr @@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough LL | let x = gimme({ | ----- borrow later used by call LL | let v = (22,); + | - binding `v` declared here LL | &v | ^^ borrowed value does not live long enough LL | diff --git a/tests/ui/nll/borrowed-match-issue-45045.stderr b/tests/ui/nll/borrowed-match-issue-45045.stderr index 9d4682667..33e3eb797 100644 --- a/tests/ui/nll/borrowed-match-issue-45045.stderr +++ b/tests/ui/nll/borrowed-match-issue-45045.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `e` because it was mutably borrowed --> $DIR/borrowed-match-issue-45045.rs:12:11 | LL | let f = &mut e; - | ------ borrow of `e` occurs here + | ------ `e` is borrowed here LL | let g = f; LL | match e { | ^ use of borrowed `e` diff --git a/tests/ui/nll/capture-ref-in-struct.stderr b/tests/ui/nll/capture-ref-in-struct.stderr index cdfe7f6db..84b7ecf2f 100644 --- a/tests/ui/nll/capture-ref-in-struct.stderr +++ b/tests/ui/nll/capture-ref-in-struct.stderr @@ -1,6 +1,9 @@ error[E0597]: `y` does not live long enough --> $DIR/capture-ref-in-struct.rs:18:16 | +LL | let y = 22; + | - binding `y` declared here +... LL | y: &y, | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/closure-access-spans.stderr b/tests/ui/nll/closure-access-spans.stderr index 0a09353b8..035dd5a56 100644 --- a/tests/ui/nll/closure-access-spans.stderr +++ b/tests/ui/nll/closure-access-spans.stderr @@ -38,7 +38,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/closure-access-spans.rs:23:13 | LL | let r = &mut x; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | move || x; | ^ use of borrowed `x` LL | r.use_ref(); @@ -47,6 +47,8 @@ LL | r.use_ref(); error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/closure-access-spans.rs:29:5 | +LL | fn closure_move_capture_conflict(mut x: String) { + | ----- binding `x` declared here LL | let r = &x; | -- borrow of `x` occurs here LL | || x; diff --git a/tests/ui/nll/closure-borrow-spans.stderr b/tests/ui/nll/closure-borrow-spans.stderr index bada4e1b8..cf0df5834 100644 --- a/tests/ui/nll/closure-borrow-spans.stderr +++ b/tests/ui/nll/closure-borrow-spans.stderr @@ -40,9 +40,9 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let f = || x; | -- - borrow occurs due to use in closure | | - | borrow of `x` occurs here + | `x` is borrowed here LL | x = 1; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | f.use_ref(); | ----------- borrow later used here @@ -52,7 +52,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed LL | let f = || x = 0; | -- - borrow occurs due to use of `x` in closure | | - | borrow of `x` occurs here + | `x` is borrowed here LL | let y = x; | ^ use of borrowed `x` LL | f.use_ref(); @@ -100,9 +100,9 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let f = || x = 0; | -- - borrow occurs due to use in closure | | - | borrow of `x` occurs here + | `x` is borrowed here LL | x = 1; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | f.use_ref(); | ----------- borrow later used here @@ -160,9 +160,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed LL | let f = || *x = 0; | -- -- borrow occurs due to use in closure | | - | borrow of `*x` occurs here + | `*x` is borrowed here LL | *x = 1; - | ^^^^^^ assignment to borrowed `*x` occurs here + | ^^^^^^ `*x` is assigned to here but it was already borrowed LL | f.use_ref(); | ----------- borrow later used here diff --git a/tests/ui/nll/closure-requirements/escape-argument.stderr b/tests/ui/nll/closure-requirements/escape-argument.stderr index f67c312b9..5a8462d4d 100644 --- a/tests/ui/nll/closure-requirements/escape-argument.stderr +++ b/tests/ui/nll/closure-requirements/escape-argument.stderr @@ -21,6 +21,9 @@ LL | fn test() { error[E0597]: `y` does not live long enough --> $DIR/escape-argument.rs:27:25 | +LL | let y = 22; + | - binding `y` declared here +LL | let mut closure = expect_sig(|p, y| *p = y); LL | closure(&mut p, &y); | ^^ borrowed value does not live long enough LL | diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index 7991abeb7..721cd45de 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -53,6 +53,8 @@ LL | fn case2() { error[E0597]: `a` does not live long enough --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26 | +LL | let a = 0; + | - binding `a` declared here LL | let cell = Cell::new(&a); | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/closure-requirements/type-test-subject-non-trivial-region.rs b/tests/ui/nll/closure-requirements/type-test-subject-non-trivial-region.rs new file mode 100644 index 000000000..d8772e868 --- /dev/null +++ b/tests/ui/nll/closure-requirements/type-test-subject-non-trivial-region.rs @@ -0,0 +1,19 @@ +// See #108639 for description. +// check-pass + +trait Trait { + type Item<'a>: 'a; +} + +fn assert_static<T: 'static>(_: T) {} +fn relate<T>(_: T, _: T) {} + +fn test_args<I: Trait>() { + let closure = |a, b| { + relate(&a, b); + assert_static(a); + }; + closure(None::<I::Item<'_>>, &None::<I::Item<'_>>); +} + +fn main() {} diff --git a/tests/ui/nll/closure-requirements/type-test-subject-opaque-1.rs b/tests/ui/nll/closure-requirements/type-test-subject-opaque-1.rs new file mode 100644 index 000000000..fce6f2fee --- /dev/null +++ b/tests/ui/nll/closure-requirements/type-test-subject-opaque-1.rs @@ -0,0 +1,18 @@ +// Regression test for #107426. +// check-pass + +use std::marker::PhantomData; +#[derive(Clone, Copy)] +pub struct Scope<'a>(&'a PhantomData<&'a mut &'a ()>); +fn event<'a, F: FnMut() + 'a>(_: Scope<'a>, _: F) {} +fn make_fn<'a>(_: Scope<'a>) -> impl Fn() + Copy + 'a { + || {} +} + +fn foo(cx: Scope) { + let open_toggle = make_fn(cx); + + || event(cx, open_toggle); +} + +fn main() {} diff --git a/tests/ui/nll/closure-requirements/type-test-subject-opaque-2.rs b/tests/ui/nll/closure-requirements/type-test-subject-opaque-2.rs new file mode 100644 index 000000000..55905850f --- /dev/null +++ b/tests/ui/nll/closure-requirements/type-test-subject-opaque-2.rs @@ -0,0 +1,17 @@ +// Resgression test for #107516. +// check-pass + +fn iter1<'a: 'a>() -> impl Iterator<Item = &'static str> { + None.into_iter() +} + +fn iter2<'a>() -> impl Iterator<Item = &'a str> { + None.into_iter() +} + +struct Bivar<'a, I: Iterator<Item = &'a str> + 'a>(I); + +fn main() { + let _ = || Bivar(iter1()); + let _ = || Bivar(iter2()); +} diff --git a/tests/ui/nll/closure-requirements/type-test-subject-unnamed-region.rs b/tests/ui/nll/closure-requirements/type-test-subject-unnamed-region.rs new file mode 100644 index 000000000..b5a95c170 --- /dev/null +++ b/tests/ui/nll/closure-requirements/type-test-subject-unnamed-region.rs @@ -0,0 +1,24 @@ +// See #108635 for description. +// check-pass + +trait Trait { + type Item<'a>: 'a; +} + +fn assert_static<T: 'static>(_: T) {} + +fn test_args<I: Trait>() { + let closure = |a, _b| assert_static(a); + + closure(None::<I::Item<'_>>, &None::<I::Item<'_>>); +} + +fn test_upvars<I: Trait>() { + let upvars = (None::<I::Item<'_>>, &None::<I::Item<'_>>); + let _closure = || { + let (a, _b) = upvars; + assert_static(a); + }; +} + +fn main() {} diff --git a/tests/ui/nll/closure-use-spans.stderr b/tests/ui/nll/closure-use-spans.stderr index ad928f1bb..0e27e5f5f 100644 --- a/tests/ui/nll/closure-use-spans.stderr +++ b/tests/ui/nll/closure-use-spans.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/closure-use-spans.rs:5:5 | LL | let y = &x; - | -- borrow of `x` occurs here + | -- `x` is borrowed here LL | x = 0; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | || *y; | -- borrow later captured here by closure @@ -12,9 +12,9 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/closure-use-spans.rs:11:5 | LL | let y = &mut x; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | x = 0; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | || *y = 1; | -- borrow later captured here by closure @@ -22,9 +22,9 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/closure-use-spans.rs:17:5 | LL | let y = &x; - | -- borrow of `x` occurs here + | -- `x` is borrowed here LL | x = 0; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | move || *y; | -- borrow later captured here by closure diff --git a/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy-proj.stderr b/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy-proj.stderr index 65be3b37e..862c925b4 100644 --- a/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy-proj.stderr +++ b/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy-proj.stderr @@ -1,6 +1,8 @@ error[E0597]: `s` does not live long enough --> $DIR/do-not-ignore-lifetime-bounds-in-copy-proj.rs:9:18 | +LL | let s = 2; + | - binding `s` declared here LL | let a = (Foo(&s),); | ^^ borrowed value does not live long enough LL | drop(a.0); diff --git a/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr b/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr index b811ba4fd..ebaf6d124 100644 --- a/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr +++ b/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr @@ -1,6 +1,8 @@ error[E0597]: `s` does not live long enough --> $DIR/do-not-ignore-lifetime-bounds-in-copy.rs:8:17 | +LL | let s = 2; + | - binding `s` declared here LL | let a = Foo(&s); | ^^ borrowed value does not live long enough LL | drop(a); diff --git a/tests/ui/nll/dont-print-desugared.stderr b/tests/ui/nll/dont-print-desugared.stderr index fad6121cb..289b246e6 100644 --- a/tests/ui/nll/dont-print-desugared.stderr +++ b/tests/ui/nll/dont-print-desugared.stderr @@ -10,6 +10,7 @@ error[E0597]: `y` does not live long enough LL | for ref mut d in v { | - a temporary with access to the borrow is created here ... LL | let y = (); + | - binding `y` declared here LL | *d = D(&y); | ^^ borrowed value does not live long enough LL | } diff --git a/tests/ui/nll/drop-no-may-dangle.stderr b/tests/ui/nll/drop-no-may-dangle.stderr index cb2808809..0ddb7adbb 100644 --- a/tests/ui/nll/drop-no-may-dangle.stderr +++ b/tests/ui/nll/drop-no-may-dangle.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `v[_]` because it is borrowed --> $DIR/drop-no-may-dangle.rs:18:9 | LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] }; - | ----- borrow of `v[_]` occurs here + | ----- `v[_]` is borrowed here ... LL | v[0] += 1; - | ^^^^^^^^^ assignment to borrowed `v[_]` occurs here + | ^^^^^^^^^ `v[_]` is assigned to here but it was already borrowed ... LL | } | - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle` @@ -14,10 +14,10 @@ error[E0506]: cannot assign to `v[_]` because it is borrowed --> $DIR/drop-no-may-dangle.rs:21:5 | LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] }; - | ----- borrow of `v[_]` occurs here + | ----- `v[_]` is borrowed here ... LL | v[0] += 1; - | ^^^^^^^^^ assignment to borrowed `v[_]` occurs here + | ^^^^^^^^^ `v[_]` is assigned to here but it was already borrowed LL | } | - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle` diff --git a/tests/ui/nll/guarantor-issue-46974.stderr b/tests/ui/nll/guarantor-issue-46974.stderr index 8854dd8d6..7edc3dcc5 100644 --- a/tests/ui/nll/guarantor-issue-46974.stderr +++ b/tests/ui/nll/guarantor-issue-46974.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `*s` because it is borrowed --> $DIR/guarantor-issue-46974.rs:7:5 | LL | let t = &mut *s; // this borrow should last for the entire function - | ------- borrow of `*s` occurs here + | ------- `*s` is borrowed here LL | let x = &t.0; LL | *s = (2,); - | ^^^^^^^^^ assignment to borrowed `*s` occurs here + | ^^^^^^^^^ `*s` is assigned to here but it was already borrowed LL | *x | -- borrow later used here diff --git a/tests/ui/nll/issue-27282-move-ref-mut-into-guard.stderr b/tests/ui/nll/issue-27282-move-ref-mut-into-guard.stderr index 45119018d..4a512560c 100644 --- a/tests/ui/nll/issue-27282-move-ref-mut-into-guard.stderr +++ b/tests/ui/nll/issue-27282-move-ref-mut-into-guard.stderr @@ -4,7 +4,7 @@ error[E0507]: cannot move out of `foo` in pattern guard LL | if { (|| { let bar = foo; bar.take() })(); false } => {}, | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait | | - | move out of `foo` occurs here + | `foo` is moved here | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard @@ -14,7 +14,7 @@ error[E0507]: cannot move out of `foo` in pattern guard LL | if let Some(()) = { (|| { let bar = foo; bar.take() })(); None } => {}, | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait | | - | move out of `foo` occurs here + | `foo` is moved here | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard diff --git a/tests/ui/nll/issue-27282-mutation-in-guard.stderr b/tests/ui/nll/issue-27282-mutation-in-guard.stderr index 1ba696593..0b5d72317 100644 --- a/tests/ui/nll/issue-27282-mutation-in-guard.stderr +++ b/tests/ui/nll/issue-27282-mutation-in-guard.stderr @@ -4,7 +4,7 @@ error[E0507]: cannot move out of `foo` in pattern guard LL | (|| { let bar = foo; bar.take() })(); | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait | | - | move out of `foo` occurs here + | `foo` is moved here | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard @@ -14,7 +14,7 @@ error[E0507]: cannot move out of `foo` in pattern guard LL | (|| { let bar = foo; bar.take() })(); | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait | | - | move out of `foo` occurs here + | `foo` is moved here | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard diff --git a/tests/ui/issues/issue-27583.rs b/tests/ui/nll/issue-27583.rs index 84c94c7c9..84c94c7c9 100644 --- a/tests/ui/issues/issue-27583.rs +++ b/tests/ui/nll/issue-27583.rs diff --git a/tests/ui/nll/issue-27868.stderr b/tests/ui/nll/issue-27868.stderr index e0b3b5494..204eda3d2 100644 --- a/tests/ui/nll/issue-27868.stderr +++ b/tests/ui/nll/issue-27868.stderr @@ -4,10 +4,10 @@ error[E0506]: cannot assign to `vecvec` because it is borrowed LL | vecvec[0] += { | ------ | | - | _____borrow of `vecvec` occurs here + | _____`vecvec` is borrowed here | | LL | | vecvec = vec![]; - | | ^^^^^^ assignment to borrowed `vecvec` occurs here + | | ^^^^^^ `vecvec` is assigned to here but it was already borrowed LL | | LL | | 0 LL | | }; diff --git a/tests/ui/nll/issue-46036.stderr b/tests/ui/nll/issue-46036.stderr index e6e95ee61..f337e2345 100644 --- a/tests/ui/nll/issue-46036.stderr +++ b/tests/ui/nll/issue-46036.stderr @@ -1,6 +1,8 @@ error[E0597]: `a` does not live long enough --> $DIR/issue-46036.rs:8:24 | +LL | let a = 3; + | - binding `a` declared here LL | let foo = Foo { x: &a }; | ^^ | | diff --git a/tests/ui/issues/issue-48179.rs b/tests/ui/nll/issue-48179.rs index f81203dc4..f81203dc4 100644 --- a/tests/ui/issues/issue-48179.rs +++ b/tests/ui/nll/issue-48179.rs diff --git a/tests/ui/nll/issue-48803.stderr b/tests/ui/nll/issue-48803.stderr index 2f94039c0..e24606e0b 100644 --- a/tests/ui/nll/issue-48803.stderr +++ b/tests/ui/nll/issue-48803.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/issue-48803.rs:10:5 | LL | let y = &x; - | -- borrow of `x` occurs here + | -- `x` is borrowed here ... LL | x = "modified"; - | ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here + | ^^^^^^^^^^^^^^ `x` is assigned to here but it was already borrowed LL | LL | println!("{}", w); // prints "modified" | - borrow later used here diff --git a/tests/ui/nll/issue-52057.rs b/tests/ui/nll/issue-52057.rs index 98f49fe8f..5991c1104 100644 --- a/tests/ui/nll/issue-52057.rs +++ b/tests/ui/nll/issue-52057.rs @@ -1,6 +1,6 @@ // Regression test for #52057. There is an implied bound -// that `I: 'a` where `'a` is the lifetime of `self` in `parse_first`; -// but to observe that, one must normalize first. +// that `I: 'x` where `'x` is the lifetime of the reference `&mut Self::Input` +// in `parse_first`; but to observe that, one must normalize first. // // run-pass diff --git a/tests/ui/nll/issue-52534-2.stderr b/tests/ui/nll/issue-52534-2.stderr index ac385e056..35d39bb6e 100644 --- a/tests/ui/nll/issue-52534-2.stderr +++ b/tests/ui/nll/issue-52534-2.stderr @@ -1,6 +1,8 @@ error[E0597]: `x` does not live long enough --> $DIR/issue-52534-2.rs:6:13 | +LL | let x = 32; + | - binding `x` declared here LL | y = &x | ^^ borrowed value does not live long enough LL | diff --git a/tests/ui/nll/issue-52663-trait-object.stderr b/tests/ui/nll/issue-52663-trait-object.stderr index 5cedea6e6..338f64841 100644 --- a/tests/ui/nll/issue-52663-trait-object.stderr +++ b/tests/ui/nll/issue-52663-trait-object.stderr @@ -1,6 +1,8 @@ error[E0597]: `tmp0` does not live long enough --> $DIR/issue-52663-trait-object.rs:12:20 | +LL | let tmp0 = 3; + | ---- binding `tmp0` declared here LL | let tmp1 = &tmp0; | ^^^^^ borrowed value does not live long enough LL | Box::new(tmp1) as Box<dyn Foo + '_> diff --git a/tests/ui/nll/issue-54382-use-span-of-tail-of-block.stderr b/tests/ui/nll/issue-54382-use-span-of-tail-of-block.stderr index d8f43cbc9..4a32c777a 100644 --- a/tests/ui/nll/issue-54382-use-span-of-tail-of-block.stderr +++ b/tests/ui/nll/issue-54382-use-span-of-tail-of-block.stderr @@ -1,6 +1,9 @@ error[E0597]: `_thing1` does not live long enough --> $DIR/issue-54382-use-span-of-tail-of-block.rs:7:29 | +LL | let mut _thing1 = D(Box::new("thing1")); + | ----------- binding `_thing1` declared here +... LL | D("other").next(&_thing1) | ----------------^^^^^^^^- | | | diff --git a/tests/ui/nll/issue-54556-niconii.stderr b/tests/ui/nll/issue-54556-niconii.stderr index a8e1edc54..d41d462f2 100644 --- a/tests/ui/nll/issue-54556-niconii.stderr +++ b/tests/ui/nll/issue-54556-niconii.stderr @@ -1,6 +1,9 @@ error[E0597]: `counter` does not live long enough --> $DIR/issue-54556-niconii.rs:22:20 | +LL | let counter = Mutex; + | ------- binding `counter` declared here +LL | LL | if let Ok(_) = counter.lock() { } | ^^^^^^^^^^^^^^ | | diff --git a/tests/ui/nll/issue-54556-stephaneyfx.stderr b/tests/ui/nll/issue-54556-stephaneyfx.stderr index 036a7a0ab..f9e82cb00 100644 --- a/tests/ui/nll/issue-54556-stephaneyfx.stderr +++ b/tests/ui/nll/issue-54556-stephaneyfx.stderr @@ -1,6 +1,8 @@ error[E0597]: `stmt` does not live long enough --> $DIR/issue-54556-stephaneyfx.rs:27:21 | +LL | let stmt = Statement; + | ---- binding `stmt` declared here LL | let rows = Rows(&stmt); | ^^^^^ borrowed value does not live long enough LL | rows.map(|row| row).next() diff --git a/tests/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr b/tests/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr index 92f5ffdf3..4eae9fdcd 100644 --- a/tests/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr +++ b/tests/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr @@ -1,6 +1,9 @@ error[E0597]: `_thing1` does not live long enough --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:11 | +LL | let mut _thing1 = D(Box::new("thing1")); + | ----------- binding `_thing1` declared here +LL | // D("other").next(&_thing1).end() LL | D(&_thing1).end() | --^^^^^^^^- | | | diff --git a/tests/ui/nll/issue-54556-used-vs-unused-tails.stderr b/tests/ui/nll/issue-54556-used-vs-unused-tails.stderr index 25226e296..a2a7a8486 100644 --- a/tests/ui/nll/issue-54556-used-vs-unused-tails.stderr +++ b/tests/ui/nll/issue-54556-used-vs-unused-tails.stderr @@ -2,11 +2,12 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:10:55 | LL | { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;` - | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | | | - | | | `_t1` dropped here while still borrowed - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | @@ -17,11 +18,12 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:13:55 | LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // suggest `;` - | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | | | - | | | `_t1` dropped here while still borrowed - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | @@ -32,11 +34,12 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:16:55 | LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // suggest `;` - | --^^^^- -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | | | - | | | `_t1` dropped here while still borrowed - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | @@ -47,11 +50,12 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:19:55 | LL | let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;` - | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | | | - | | | `_t1` dropped here while still borrowed - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | @@ -62,11 +66,12 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:22:55 | LL | let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // suggest `;` - | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | | | - | | | `_t1` dropped here while still borrowed - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | @@ -77,11 +82,12 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:25:55 | LL | let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` - | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | | | - | | | `_t1` dropped here while still borrowed - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | = note: the temporary is part of an expression at the end of a block; consider forcing this temporary to be dropped sooner, before the block's local variables are dropped @@ -94,11 +100,12 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:30:55 | LL | _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` - | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | | | - | | | `_t1` dropped here while still borrowed - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | = note: the temporary is part of an expression at the end of a block; consider forcing this temporary to be dropped sooner, before the block's local variables are dropped @@ -111,12 +118,13 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:37:55 | LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // suggest `;` - | --^^^^- - - | | | | - | | | `_t1` dropped here while still borrowed - | | | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | @@ -127,12 +135,13 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:40:55 | LL | fn f() -> String { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } // `let x = ...; x` - | --^^^^- - - | | | | - | | | `_t1` dropped here while still borrowed - | | | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | = note: the temporary is part of an expression at the end of a block; consider forcing this temporary to be dropped sooner, before the block's local variables are dropped diff --git a/tests/ui/nll/issue-54556-wrap-it-up.stderr b/tests/ui/nll/issue-54556-wrap-it-up.stderr index 9f27fac15..adc419ae5 100644 --- a/tests/ui/nll/issue-54556-wrap-it-up.stderr +++ b/tests/ui/nll/issue-54556-wrap-it-up.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/issue-54556-wrap-it-up.rs:27:5 | LL | let wrap = Wrap { p: &mut x }; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here ... LL | x = 1; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/tests/ui/nll/issue-55511.stderr b/tests/ui/nll/issue-55511.stderr index bf3e58e8c..ecb9ef0ae 100644 --- a/tests/ui/nll/issue-55511.stderr +++ b/tests/ui/nll/issue-55511.stderr @@ -1,6 +1,8 @@ error[E0597]: `a` does not live long enough --> $DIR/issue-55511.rs:13:28 | +LL | let a = 22; + | - binding `a` declared here LL | let b = Some(Cell::new(&a)); | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr b/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr index 6e96f40c0..d1e94bc70 100644 --- a/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr +++ b/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr @@ -1,8 +1,8 @@ -error[E0599]: the function or associated item `make_g` exists for fn pointer `for<'a> fn(&'a ())`, but its trait bounds were not satisfied +error[E0599]: the function or associated item `make_g` exists for fn pointer `fn(&())`, but its trait bounds were not satisfied --> $DIR/issue-57642-higher-ranked-subtype.rs:31:25 | LL | let x = <fn (&())>::make_g(); - | ^^^^^^ function or associated item cannot be called on `for<'a> fn(&'a ())` due to unsatisfied trait bounds + | ^^^^^^ function or associated item cannot be called on `fn(&())` due to unsatisfied trait bounds | = note: the following trait bounds were not satisfied: `for<'a> fn(&'a ()): X` @@ -17,7 +17,7 @@ error[E0599]: no function or associated item named `make_f` found for fn pointer --> $DIR/issue-57642-higher-ranked-subtype.rs:35:25 | LL | let x = <fn (&())>::make_f(); - | ^^^^^^ function or associated item not found in `for<'a> fn(&'a ())` + | ^^^^^^ function or associated item not found in `fn(&())` | = help: items from traits can only be used if the trait is implemented and in scope note: `Y` defines an item `make_f`, perhaps you need to implement it diff --git a/tests/ui/nll/issue-57989.stderr b/tests/ui/nll/issue-57989.stderr index 31f40d825..d5effd6f3 100644 --- a/tests/ui/nll/issue-57989.stderr +++ b/tests/ui/nll/issue-57989.stderr @@ -13,9 +13,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed --> $DIR/issue-57989.rs:5:5 | LL | let g = &x; - | -- borrow of `*x` occurs here + | -- `*x` is borrowed here LL | *x = 0; - | ^^^^^^ assignment to borrowed `*x` occurs here + | ^^^^^^ `*x` is assigned to here but it was already borrowed LL | LL | g; | - borrow later used here diff --git a/tests/ui/nll/issue-68550.stderr b/tests/ui/nll/issue-68550.stderr index e234ebb04..851e36287 100644 --- a/tests/ui/nll/issue-68550.stderr +++ b/tests/ui/nll/issue-68550.stderr @@ -2,7 +2,9 @@ error[E0597]: `x` does not live long enough --> $DIR/issue-68550.rs:12:20 | LL | fn run<'a, A>(x: A) - | -- lifetime `'a` defined here + | -- - binding `x` declared here + | | + | lifetime `'a` defined here ... LL | let _: &'a A = &x; | ----- ^^ borrowed value does not live long enough diff --git a/tests/ui/nll/issue-69114-static-mut-ty.stderr b/tests/ui/nll/issue-69114-static-mut-ty.stderr index 5e55cb502..1b41230d7 100644 --- a/tests/ui/nll/issue-69114-static-mut-ty.stderr +++ b/tests/ui/nll/issue-69114-static-mut-ty.stderr @@ -1,6 +1,9 @@ error[E0597]: `n` does not live long enough --> $DIR/issue-69114-static-mut-ty.rs:19:15 | +LL | let n = 42; + | - binding `n` declared here +LL | unsafe { LL | BAR = &n; | ------^^ | | | @@ -13,6 +16,9 @@ LL | } error[E0597]: `n` does not live long enough --> $DIR/issue-69114-static-mut-ty.rs:27:22 | +LL | let n = 42; + | - binding `n` declared here +LL | unsafe { LL | BAR_ELIDED = &n; | -------------^^ | | | diff --git a/tests/ui/nll/issue-69114-static-ty.stderr b/tests/ui/nll/issue-69114-static-ty.stderr index 0815e74b5..9215e850f 100644 --- a/tests/ui/nll/issue-69114-static-ty.stderr +++ b/tests/ui/nll/issue-69114-static-ty.stderr @@ -1,6 +1,8 @@ error[E0597]: `n` does not live long enough --> $DIR/issue-69114-static-ty.rs:7:9 | +LL | let n = 42; + | - binding `n` declared here LL | FOO(&n); | ----^^- | | | diff --git a/tests/ui/nll/issue-73159-rpit-static.stderr b/tests/ui/nll/issue-73159-rpit-static.stderr index 260b9b597..4d3a90153 100644 --- a/tests/ui/nll/issue-73159-rpit-static.stderr +++ b/tests/ui/nll/issue-73159-rpit-static.stderr @@ -4,6 +4,7 @@ error[E0700]: hidden type for `impl Iterator<Item = u8>` captures lifetime that LL | impl<'a> Foo<'a> { | -- hidden type `Copied<std::slice::Iter<'a, u8>>` captures the lifetime `'a` as defined here LL | fn make_it(&self) -> impl Iterator<Item = u8> { + | ------------------------ opaque type defined here LL | self.0.iter().copied() | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-75777.rs b/tests/ui/nll/issue-75777.rs index a1e438bc6..a1e438bc6 100644 --- a/tests/ui/issues/issue-75777.rs +++ b/tests/ui/nll/issue-75777.rs diff --git a/tests/ui/issues/issue-75777.stderr b/tests/ui/nll/issue-75777.stderr index 370cd72fd..370cd72fd 100644 --- a/tests/ui/issues/issue-75777.stderr +++ b/tests/ui/nll/issue-75777.stderr diff --git a/tests/ui/nll/loan_ends_mid_block_pair.stderr b/tests/ui/nll/loan_ends_mid_block_pair.stderr index eb8442b31..58e378ab0 100644 --- a/tests/ui/nll/loan_ends_mid_block_pair.stderr +++ b/tests/ui/nll/loan_ends_mid_block_pair.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `data.0` because it is borrowed --> $DIR/loan_ends_mid_block_pair.rs:12:5 | LL | let c = &mut data.0; - | ----------- borrow of `data.0` occurs here + | ----------- `data.0` is borrowed here LL | capitalize(c); LL | data.0 = 'e'; - | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here + | ^^^^^^^^^^^^ `data.0` is assigned to here but it was already borrowed ... LL | capitalize(c); | - borrow later used here diff --git a/tests/ui/nll/local-outlives-static-via-hrtb.stderr b/tests/ui/nll/local-outlives-static-via-hrtb.stderr index f5c10f3dd..a6b3328b5 100644 --- a/tests/ui/nll/local-outlives-static-via-hrtb.stderr +++ b/tests/ui/nll/local-outlives-static-via-hrtb.stderr @@ -1,6 +1,8 @@ error[E0597]: `local` does not live long enough --> $DIR/local-outlives-static-via-hrtb.rs:24:28 | +LL | let local = 0; + | ----- binding `local` declared here LL | assert_static_via_hrtb(&local); | -----------------------^^^^^^- | | | @@ -19,6 +21,9 @@ LL | fn assert_static_via_hrtb<G>(_: G) where for<'a> G: Outlives<'a> {} error[E0597]: `local` does not live long enough --> $DIR/local-outlives-static-via-hrtb.rs:25:45 | +LL | let local = 0; + | ----- binding `local` declared here +LL | assert_static_via_hrtb(&local); LL | assert_static_via_hrtb_with_assoc_type(&&local); | ----------------------------------------^^^^^^- | | | diff --git a/tests/ui/nll/match-cfg-fake-edges2.stderr b/tests/ui/nll/match-cfg-fake-edges2.stderr index c6d15a936..36f2cd0b8 100644 --- a/tests/ui/nll/match-cfg-fake-edges2.stderr +++ b/tests/ui/nll/match-cfg-fake-edges2.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `y.1` because it was mutably borrowed --> $DIR/match-cfg-fake-edges2.rs:8:5 | LL | let r = &mut y.1; - | -------- borrow of `y.1` occurs here + | -------- `y.1` is borrowed here ... LL | match y { | ^^^^^^^ use of borrowed `y.1` diff --git a/tests/ui/nll/match-guards-always-borrow.stderr b/tests/ui/nll/match-guards-always-borrow.stderr index fa01d3a6f..afd853c40 100644 --- a/tests/ui/nll/match-guards-always-borrow.stderr +++ b/tests/ui/nll/match-guards-always-borrow.stderr @@ -4,7 +4,7 @@ error[E0507]: cannot move out of `foo` in pattern guard LL | (|| { let bar = foo; bar.take() })(); | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait | | - | move out of `foo` occurs here + | `foo` is moved here | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard @@ -14,7 +14,7 @@ error[E0507]: cannot move out of `foo` in pattern guard LL | (|| { let bar = foo; bar.take() })(); | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait | | - | move out of `foo` occurs here + | `foo` is moved here | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard diff --git a/tests/ui/nll/match-guards-partially-borrow.stderr b/tests/ui/nll/match-guards-partially-borrow.stderr index 60b8dee71..7bdcbcb9c 100644 --- a/tests/ui/nll/match-guards-partially-borrow.stderr +++ b/tests/ui/nll/match-guards-partially-borrow.stderr @@ -74,9 +74,9 @@ error[E0506]: cannot assign to `t` because it is borrowed --> $DIR/match-guards-partially-borrow.rs:225:13 | LL | s if { - | - borrow of `t` occurs here + | - `t` is borrowed here LL | t = !t; - | ^^^^^^ assignment to borrowed `t` occurs here + | ^^^^^^ `t` is assigned to here but it was already borrowed LL | false LL | } => (), // What value should `s` have in the arm? | - borrow later used here @@ -85,9 +85,9 @@ error[E0506]: cannot assign to `t` because it is borrowed --> $DIR/match-guards-partially-borrow.rs:235:13 | LL | s if let Some(()) = { - | - borrow of `t` occurs here + | - `t` is borrowed here LL | t = !t; - | ^^^^^^ assignment to borrowed `t` occurs here + | ^^^^^^ `t` is assigned to here but it was already borrowed LL | None LL | } => (), // What value should `s` have in the arm? | - borrow later used here diff --git a/tests/ui/nll/match-on-borrowed.stderr b/tests/ui/nll/match-on-borrowed.stderr index 32666529f..927348456 100644 --- a/tests/ui/nll/match-on-borrowed.stderr +++ b/tests/ui/nll/match-on-borrowed.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `e` because it was mutably borrowed --> $DIR/match-on-borrowed.rs:47:11 | LL | E::V(ref mut x, _) => x, - | --------- borrow of `e.0` occurs here + | --------- `e.0` is borrowed here ... LL | match e { // Don't know that E uses a tag for its discriminant | ^ use of borrowed `e.0` @@ -14,7 +14,7 @@ error[E0503]: cannot use `*f` because it was mutably borrowed --> $DIR/match-on-borrowed.rs:61:11 | LL | E::V(ref mut x, _) => x, - | --------- borrow of `f.0` occurs here + | --------- `f.0` is borrowed here ... LL | match f { // Don't know that E uses a tag for its discriminant | ^ use of borrowed `f.0` @@ -26,7 +26,7 @@ error[E0503]: cannot use `t` because it was mutably borrowed --> $DIR/match-on-borrowed.rs:81:5 | LL | let x = &mut t; - | ------ borrow of `t` occurs here + | ------ `t` is borrowed here LL | match t { | ^^^^^^^ use of borrowed `t` ... diff --git a/tests/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr b/tests/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr index 80e297807..55646b9dc 100644 --- a/tests/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr +++ b/tests/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/maybe-initialized-drop-implicit-fragment-drop.rs:17:5 | LL | let wrap = Wrap { p: &mut x }; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here ... LL | x = 1; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | // FIXME ^ Should not error in the future with implicit dtors, only manually implemented ones LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/tests/ui/nll/maybe-initialized-drop-with-fragment.stderr b/tests/ui/nll/maybe-initialized-drop-with-fragment.stderr index 14074472e..c89f94a78 100644 --- a/tests/ui/nll/maybe-initialized-drop-with-fragment.stderr +++ b/tests/ui/nll/maybe-initialized-drop-with-fragment.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/maybe-initialized-drop-with-fragment.rs:19:5 | LL | let wrap = Wrap { p: &mut x }; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here ... LL | x = 1; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr b/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr index 91c0afc1d..90db13bc5 100644 --- a/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr +++ b/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/maybe-initialized-drop-with-uninitialized-fragments.rs:20:5 | LL | let wrap = Wrap { p: &mut x }; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here ... LL | x = 1; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | // FIXME ^ This currently errors and it should not. LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/tests/ui/nll/maybe-initialized-drop.stderr b/tests/ui/nll/maybe-initialized-drop.stderr index 9825ba461..15a53a09a 100644 --- a/tests/ui/nll/maybe-initialized-drop.stderr +++ b/tests/ui/nll/maybe-initialized-drop.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/maybe-initialized-drop.rs:14:5 | LL | let wrap = Wrap { p: &mut x }; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | x = 1; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | } | - borrow might be used here, when `wrap` is dropped and runs the `Drop` code for type `Wrap` diff --git a/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.rs b/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.rs new file mode 100644 index 000000000..52ea0f28d --- /dev/null +++ b/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.rs @@ -0,0 +1,43 @@ +// ... continued from ./min-choice.rs + +// check-fail + +trait Cap<'a> {} +impl<T> Cap<'_> for T {} + +fn type_test<'a, T: 'a>() -> &'a u8 { &0 } + +// Make sure we don't pick `'b`. +fn test_b<'a, 'b, 'c, T>() -> impl Cap<'a> + Cap<'b> + Cap<'c> +where + 'a: 'b, + 'a: 'c, + T: 'b, +{ + type_test::<'_, T>() // This should pass if we pick 'b. + //~^ ERROR the parameter type `T` may not live long enough +} + +// Make sure we don't pick `'c`. +fn test_c<'a, 'b, 'c, T>() -> impl Cap<'a> + Cap<'b> + Cap<'c> +where + 'a: 'b, + 'a: 'c, + T: 'c, +{ + type_test::<'_, T>() // This should pass if we pick 'c. + //~^ ERROR the parameter type `T` may not live long enough +} + +// We need to pick min_choice from `['b, 'c]`, but it's ambiguous which one to pick because +// they're incomparable. +fn test_ambiguous<'a, 'b, 'c>(s: &'a u8) -> impl Cap<'b> + Cap<'c> +where + 'a: 'b, + 'a: 'c, +{ + s + //~^ ERROR captures lifetime that does not appear in bounds +} + +fn main() {} diff --git a/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr b/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr new file mode 100644 index 000000000..e0d476a33 --- /dev/null +++ b/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr @@ -0,0 +1,42 @@ +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/min-choice-reject-ambiguous.rs:17:5 + | +LL | type_test::<'_, T>() // This should pass if we pick 'b. + | ^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound... + | +LL | T: 'b + 'a, + | ++++ + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/min-choice-reject-ambiguous.rs:28:5 + | +LL | type_test::<'_, T>() // This should pass if we pick 'c. + | ^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound... + | +LL | T: 'c + 'a, + | ++++ + +error[E0700]: hidden type for `impl Cap<'b> + Cap<'c>` captures lifetime that does not appear in bounds + --> $DIR/min-choice-reject-ambiguous.rs:39:5 + | +LL | fn test_ambiguous<'a, 'b, 'c>(s: &'a u8) -> impl Cap<'b> + Cap<'c> + | -- ---------------------- opaque type defined here + | | + | hidden type `&'a u8` captures the lifetime `'a` as defined here +... +LL | s + | ^ + | +help: to declare that `impl Cap<'b> + Cap<'c>` captures `'a`, you can add an explicit `'a` lifetime bound + | +LL | fn test_ambiguous<'a, 'b, 'c>(s: &'a u8) -> impl Cap<'b> + Cap<'c> + 'a + | ++++ + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0309, E0700. +For more information about an error, try `rustc --explain E0309`. diff --git a/tests/ui/nll/member-constraints/min-choice.rs b/tests/ui/nll/member-constraints/min-choice.rs new file mode 100644 index 000000000..14b4dae7a --- /dev/null +++ b/tests/ui/nll/member-constraints/min-choice.rs @@ -0,0 +1,34 @@ +// Assuming that the hidden type in these tests is `&'_#15r u8`, +// we have a member constraint: `'_#15r member ['static, 'a, 'b, 'c]`. +// +// Make sure we pick up the minimum non-ambiguous region among them. +// We will have to exclude `['b, 'c]` because they're incomparable, +// and then we should pick `'a` because we know `'static: 'a`. + +// check-pass + +trait Cap<'a> {} +impl<T> Cap<'_> for T {} + +fn type_test<'a, T: 'a>() -> &'a u8 { &0 } + +// Basic test: make sure we don't bail out because 'b and 'c are incomparable. +fn basic<'a, 'b, 'c>() -> impl Cap<'a> + Cap<'b> + Cap<'c> +where + 'a: 'b, + 'a: 'c, +{ + &0 +} + +// Make sure we don't pick `'static`. +fn test_static<'a, 'b, 'c, T>() -> impl Cap<'a> + Cap<'b> + Cap<'c> +where + 'a: 'b, + 'a: 'c, + T: 'a, +{ + type_test::<'_, T>() // This will fail if we pick 'static +} + +fn main() {} diff --git a/tests/ui/nll/member-constraints/nested-impl-trait-fail.rs b/tests/ui/nll/member-constraints/nested-impl-trait-fail.rs new file mode 100644 index 000000000..66ff828a8 --- /dev/null +++ b/tests/ui/nll/member-constraints/nested-impl-trait-fail.rs @@ -0,0 +1,33 @@ +// Nested impl-traits can impose different member constraints on the same region variable. + +// check-fail + +trait Cap<'a> {} +impl<T> Cap<'_> for T {} + +// Assuming the hidden type is `[&'_#15r u8; 1]`, we have two distinct member constraints: +// - '_#15r member ['static, 'a, 'b] // from outer impl-trait +// - '_#15r member ['static, 'a, 'b] // from inner impl-trait +// To satisfy both we can choose 'a or 'b, so it's a failure due to ambiguity. +fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> +where + 's: 'a, + 's: 'b, +{ + [a] + //~^ E0700 + //~| E0700 +} + +// Same as the above but with late-bound regions. +fn fail_late_bound<'s, 'a, 'b>( + a: &'s u8, + _: &'a &'s u8, + _: &'b &'s u8, +) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> { + [a] + //~^ E0700 + //~| E0700 +} + +fn main() {} diff --git a/tests/ui/nll/member-constraints/nested-impl-trait-fail.stderr b/tests/ui/nll/member-constraints/nested-impl-trait-fail.stderr new file mode 100644 index 000000000..483b5822b --- /dev/null +++ b/tests/ui/nll/member-constraints/nested-impl-trait-fail.stderr @@ -0,0 +1,83 @@ +error[E0700]: hidden type for `impl IntoIterator<Item = impl Cap<'a> + Cap<'b>>` captures lifetime that does not appear in bounds + --> $DIR/nested-impl-trait-fail.rs:17:5 + | +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> + | -- ------------------------------------------------ opaque type defined here + | | + | hidden type `[&'s u8; 1]` captures the lifetime `'s` as defined here +... +LL | [a] + | ^^^ + | +help: to declare that `impl IntoIterator<Item = impl Cap<'a> + Cap<'b>>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> + 's + | ++++ +help: to declare that `impl Cap<'a> + Cap<'b>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b> + 's> + | ++++ + +error[E0700]: hidden type for `impl Cap<'a> + Cap<'b>` captures lifetime that does not appear in bounds + --> $DIR/nested-impl-trait-fail.rs:17:5 + | +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> + | -- ---------------------- opaque type defined here + | | + | hidden type `&'s u8` captures the lifetime `'s` as defined here +... +LL | [a] + | ^^^ + | +help: to declare that `impl IntoIterator<Item = impl Cap<'a> + Cap<'b>>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> + 's + | ++++ +help: to declare that `impl Cap<'a> + Cap<'b>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b> + 's> + | ++++ + +error[E0700]: hidden type for `impl IntoIterator<Item = impl Cap<'a> + Cap<'b>>` captures lifetime that does not appear in bounds + --> $DIR/nested-impl-trait-fail.rs:28:5 + | +LL | fn fail_late_bound<'s, 'a, 'b>( + | -- hidden type `[&'s u8; 1]` captures the lifetime `'s` as defined here +... +LL | ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> { + | ------------------------------------------------ opaque type defined here +LL | [a] + | ^^^ + | +help: to declare that `impl IntoIterator<Item = impl Cap<'a> + Cap<'b>>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> + 's { + | ++++ +help: to declare that `impl Cap<'a> + Cap<'b>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b> + 's> { + | ++++ + +error[E0700]: hidden type for `impl Cap<'a> + Cap<'b>` captures lifetime that does not appear in bounds + --> $DIR/nested-impl-trait-fail.rs:28:5 + | +LL | fn fail_late_bound<'s, 'a, 'b>( + | -- hidden type `&'s u8` captures the lifetime `'s` as defined here +... +LL | ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> { + | ---------------------- opaque type defined here +LL | [a] + | ^^^ + | +help: to declare that `impl IntoIterator<Item = impl Cap<'a> + Cap<'b>>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> + 's { + | ++++ +help: to declare that `impl Cap<'a> + Cap<'b>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b> + 's> { + | ++++ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0700`. diff --git a/tests/ui/nll/member-constraints/nested-impl-trait-pass.rs b/tests/ui/nll/member-constraints/nested-impl-trait-pass.rs new file mode 100644 index 000000000..15540cb46 --- /dev/null +++ b/tests/ui/nll/member-constraints/nested-impl-trait-pass.rs @@ -0,0 +1,29 @@ +// Nested impl-traits can impose different member constraints on the same region variable. + +// check-pass + +trait Cap<'a> {} +impl<T> Cap<'_> for T {} + +// Assuming the hidden type is `[&'_#15r u8; 1]`, we have two distinct member constraints: +// - '_#15r member ['static, 'a, 'b] // from outer impl-trait +// - '_#15r member ['static, 'a] // from inner impl-trait +// To satisfy both we can only choose 'a. +fn pass_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl Cap<'a>> + Cap<'b> +where + 's: 'a, + 's: 'b, +{ + [a] +} + +// Same as the above but with late-bound regions. +fn pass_late_bound<'s, 'a, 'b>( + a: &'s u8, + _: &'a &'s u8, + _: &'b &'s u8, +) -> impl IntoIterator<Item = impl Cap<'a>> + Cap<'b> { + [a] +} + +fn main() {} diff --git a/tests/ui/nll/outlives-suggestion-simple.stderr b/tests/ui/nll/outlives-suggestion-simple.stderr index a8368c494..bcffd575a 100644 --- a/tests/ui/nll/outlives-suggestion-simple.stderr +++ b/tests/ui/nll/outlives-suggestion-simple.stderr @@ -73,7 +73,7 @@ LL | impl<'a> Bar<'a> { LL | pub fn get<'b>(&self) -> &'b usize { | -- lifetime `'b` defined here LL | self.x - | ^^^^^^ associated function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + | ^^^^^^ method was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` | = help: consider adding the following bound: `'a: 'b` @@ -85,7 +85,7 @@ LL | impl<'a> Baz<'a> { LL | fn get<'b>(&'b self) -> &'a i32 { | -- lifetime `'b` defined here LL | self.x - | ^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + | ^^^^^^ method was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` | = help: consider adding the following bound: `'b: 'a` diff --git a/tests/ui/nll/polonius/polonius-smoke-test.stderr b/tests/ui/nll/polonius/polonius-smoke-test.stderr index fa1a6a9c9..534813b2d 100644 --- a/tests/ui/nll/polonius/polonius-smoke-test.stderr +++ b/tests/ui/nll/polonius/polonius-smoke-test.stderr @@ -8,7 +8,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/polonius-smoke-test.rs:12:13 | LL | let y = &mut x; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | let z = x; | ^ use of borrowed `x` LL | let w = y; @@ -18,7 +18,9 @@ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/polonius-smoke-test.rs:18:13 | LL | pub fn use_while_mut_fr(x: &mut i32) -> &mut i32 { - | - let's call the lifetime of this reference `'1` + | - - let's call the lifetime of this reference `'1` + | | + | binding `x` declared here LL | let y = &mut *x; | ------- borrow of `*x` occurs here LL | let z = x; @@ -29,6 +31,8 @@ LL | y error[E0505]: cannot move out of `s` because it is borrowed --> $DIR/polonius-smoke-test.rs:42:5 | +LL | let s = &mut 1; + | - binding `s` declared here LL | let r = &mut *s; | ------- borrow of `*s` occurs here LL | let tmp = foo(&r); diff --git a/tests/ui/nll/promoted-bounds.stderr b/tests/ui/nll/promoted-bounds.stderr index df347f4e7..d111256b8 100644 --- a/tests/ui/nll/promoted-bounds.stderr +++ b/tests/ui/nll/promoted-bounds.stderr @@ -4,6 +4,7 @@ error[E0597]: `l` does not live long enough LL | let ptr = { | --- borrow later stored here LL | let l = 3; + | - binding `l` declared here LL | let b = &l; | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/reference-carried-through-struct-field.stderr b/tests/ui/nll/reference-carried-through-struct-field.stderr index 56d878e43..5672b9cd7 100644 --- a/tests/ui/nll/reference-carried-through-struct-field.stderr +++ b/tests/ui/nll/reference-carried-through-struct-field.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/reference-carried-through-struct-field.rs:6:5 | LL | let wrapper = Wrap { w: &mut x }; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | x += 1; | ^^^^^^ use of borrowed `x` LL | *wrapper.w += 1; diff --git a/tests/ui/nll/relate_tys/var-appears-twice.stderr b/tests/ui/nll/relate_tys/var-appears-twice.stderr index d032ce6f2..ff6ea598f 100644 --- a/tests/ui/nll/relate_tys/var-appears-twice.stderr +++ b/tests/ui/nll/relate_tys/var-appears-twice.stderr @@ -1,6 +1,9 @@ error[E0597]: `b` does not live long enough --> $DIR/var-appears-twice.rs:20:38 | +LL | let b = 44; + | - binding `b` declared here +... LL | let x: DoubleCell<_> = make_cell(&b); | ------------- ^^ borrowed value does not live long enough | | diff --git a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr index 7b9ed171d..7fcb68252 100644 --- a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr +++ b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr @@ -2,7 +2,9 @@ error[E0700]: hidden type for `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::fo --> $DIR/impl-trait-captures.rs:11:5 | LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> { - | -- hidden type `&ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_)) T` captures the anonymous lifetime defined here + | -- ------------ opaque type defined here + | | + | hidden type `&ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_)) T` captures the anonymous lifetime defined here LL | x | ^ | diff --git a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr index dbda04c42..11ada59c0 100644 --- a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -110,7 +110,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 4 - = note: where <T as Anything<ReEarlyBound(1, 'b)>>::AssocType: '_#3r + = note: where <T as Anything<'_#2r>>::AssocType: '_#3r note: no external requirements --> $DIR/projection-one-region-closure.rs:62:1 diff --git a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr index 250c796e2..47d4f2e46 100644 --- a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -86,7 +86,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 4 - = note: where <T as Anything<ReEarlyBound(1, 'b)>>::AssocType: '_#3r + = note: where <T as Anything<'_#2r>>::AssocType: '_#3r note: no external requirements --> $DIR/projection-one-region-trait-bound-closure.rs:52:1 diff --git a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index 90f049142..530dd8681 100644 --- a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -11,7 +11,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); ] = note: late-bound region is '_#4r = note: number of external vids: 5 - = note: where <T as Anything<ReEarlyBound(0, 'b), ReEarlyBound(1, 'c)>>::AssocType: '_#3r + = note: where <T as Anything<'_#1r, '_#2r>>::AssocType: '_#3r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:34:1 @@ -23,14 +23,14 @@ LL | | T: Anything<'b, 'c>, | = note: defining type: no_relationships_late::<'_#1r, '_#2r, T> -error[E0309]: the associated type `<T as Anything<ReEarlyBound(0, 'b), ReEarlyBound(1, 'c)>>::AssocType` may not live long enough +error[E0309]: the associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may not live long enough --> $DIR/projection-two-region-trait-bound-closure.rs:38:39 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^ | - = help: consider adding an explicit lifetime bound `<T as Anything<ReEarlyBound(0, 'b), ReEarlyBound(1, 'c)>>::AssocType: 'a`... - = note: ...so that the type `<T as Anything<ReEarlyBound(0, 'b), ReEarlyBound(1, 'c)>>::AssocType` will meet its required lifetime bounds + = help: consider adding an explicit lifetime bound `<T as Anything<'_#5r, '_#6r>>::AssocType: 'a`... + = note: ...so that the type `<T as Anything<'_#5r, '_#6r>>::AssocType` will meet its required lifetime bounds note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:48:29 @@ -44,7 +44,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 5 - = note: where <T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType: '_#4r + = note: where <T as Anything<'_#2r, '_#3r>>::AssocType: '_#4r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:43:1 @@ -57,14 +57,14 @@ LL | | 'a: 'a, | = note: defining type: no_relationships_early::<'_#1r, '_#2r, '_#3r, T> -error[E0309]: the associated type `<T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType` may not live long enough +error[E0309]: the associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough --> $DIR/projection-two-region-trait-bound-closure.rs:48:39 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^ | - = help: consider adding an explicit lifetime bound `<T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType: 'a`... - = note: ...so that the type `<T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType` will meet its required lifetime bounds + = help: consider adding an explicit lifetime bound `<T as Anything<'_#6r, '_#7r>>::AssocType: 'a`... + = note: ...so that the type `<T as Anything<'_#6r, '_#7r>>::AssocType` will meet its required lifetime bounds note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:61:29 @@ -78,7 +78,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 5 - = note: where <T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType: '_#4r + = note: where <T as Anything<'_#2r, '_#3r>>::AssocType: '_#4r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:53:1 @@ -103,7 +103,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 5 - = note: where <T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType: '_#4r + = note: where <T as Anything<'_#2r, '_#3r>>::AssocType: '_#4r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:65:1 @@ -128,7 +128,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 5 - = note: where <T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType: '_#4r + = note: where <T as Anything<'_#2r, '_#3r>>::AssocType: '_#4r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:74:1 @@ -154,7 +154,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); ] = note: late-bound region is '_#3r = note: number of external vids: 4 - = note: where <T as Anything<ReEarlyBound(0, 'b), ReEarlyBound(0, 'b)>>::AssocType: '_#2r + = note: where <T as Anything<'_#1r, '_#1r>>::AssocType: '_#2r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:83:1 @@ -194,7 +194,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 4 - = note: where <T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(1, 'b)>>::AssocType: '_#3r + = note: where <T as Anything<'_#2r, '_#2r>>::AssocType: '_#3r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:92:1 @@ -219,7 +219,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 3 - = note: where <T as Anything<ReEarlyBound(0, 'a), ReEarlyBound(0, 'a)>>::AssocType: '_#2r + = note: where <T as Anything<'_#1r, '_#1r>>::AssocType: '_#2r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:101:1 diff --git a/tests/ui/nll/user-annotations/adt-brace-enums.stderr b/tests/ui/nll/user-annotations/adt-brace-enums.stderr index 253e38251..9e94fd5a7 100644 --- a/tests/ui/nll/user-annotations/adt-brace-enums.stderr +++ b/tests/ui/nll/user-annotations/adt-brace-enums.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-brace-enums.rs:25:48 | +LL | let c = 66; + | - binding `c` declared here LL | SomeEnum::SomeVariant::<&'static u32> { t: &c }; | ^^ | | @@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; + | - binding `c` declared here LL | SomeEnum::SomeVariant::<&'a u32> { t: &c }; | ^^ | | diff --git a/tests/ui/nll/user-annotations/adt-brace-structs.stderr b/tests/ui/nll/user-annotations/adt-brace-structs.stderr index 8b9d1705d..cbb7f6a55 100644 --- a/tests/ui/nll/user-annotations/adt-brace-structs.stderr +++ b/tests/ui/nll/user-annotations/adt-brace-structs.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-brace-structs.rs:23:37 | +LL | let c = 66; + | - binding `c` declared here LL | SomeStruct::<&'static u32> { t: &c }; | ^^ | | @@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; + | - binding `c` declared here LL | SomeStruct::<&'a u32> { t: &c }; | ^^ | | diff --git a/tests/ui/nll/user-annotations/adt-nullary-enums.stderr b/tests/ui/nll/user-annotations/adt-nullary-enums.stderr index 3326fa521..bca85a90d 100644 --- a/tests/ui/nll/user-annotations/adt-nullary-enums.stderr +++ b/tests/ui/nll/user-annotations/adt-nullary-enums.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-nullary-enums.rs:33:41 | +LL | let c = 66; + | - binding `c` declared here LL | / combine( LL | | SomeEnum::SomeVariant(Cell::new(&c)), | | ^^ borrowed value does not live long enough @@ -15,7 +17,9 @@ error[E0597]: `c` does not live long enough | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here -... +LL | let c = 66; + | - binding `c` declared here +LL | combine( LL | SomeEnum::SomeVariant(Cell::new(&c)), | ----------^^- | | | diff --git a/tests/ui/nll/user-annotations/adt-tuple-enums.stderr b/tests/ui/nll/user-annotations/adt-tuple-enums.stderr index 2fa704263..d2d85ec2b 100644 --- a/tests/ui/nll/user-annotations/adt-tuple-enums.stderr +++ b/tests/ui/nll/user-annotations/adt-tuple-enums.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-tuple-enums.rs:28:43 | +LL | let c = 66; + | - binding `c` declared here LL | SomeEnum::SomeVariant::<&'static u32>(&c); | ^^ | | @@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; + | - binding `c` declared here LL | SomeEnum::SomeVariant::<&'a u32>(&c); | ^^ | | diff --git a/tests/ui/nll/user-annotations/adt-tuple-struct-calls.stderr b/tests/ui/nll/user-annotations/adt-tuple-struct-calls.stderr index 9664fb9f5..b7bc2a10b 100644 --- a/tests/ui/nll/user-annotations/adt-tuple-struct-calls.stderr +++ b/tests/ui/nll/user-annotations/adt-tuple-struct-calls.stderr @@ -1,6 +1,9 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-tuple-struct-calls.rs:27:7 | +LL | let c = 66; + | - binding `c` declared here +LL | let f = SomeStruct::<&'static u32>; LL | f(&c); | --^^- | | | @@ -14,7 +17,9 @@ error[E0597]: `c` does not live long enough | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here -... +LL | let c = 66; + | - binding `c` declared here +LL | let f = SomeStruct::<&'a u32>; LL | f(&c); | --^^- | | | diff --git a/tests/ui/nll/user-annotations/adt-tuple-struct.stderr b/tests/ui/nll/user-annotations/adt-tuple-struct.stderr index 76b525225..97d39da26 100644 --- a/tests/ui/nll/user-annotations/adt-tuple-struct.stderr +++ b/tests/ui/nll/user-annotations/adt-tuple-struct.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-tuple-struct.rs:23:32 | +LL | let c = 66; + | - binding `c` declared here LL | SomeStruct::<&'static u32>(&c); | ^^ | | @@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; + | - binding `c` declared here LL | SomeStruct::<&'a u32>(&c); | ^^ | | diff --git a/tests/ui/nll/user-annotations/cast_static_lifetime.stderr b/tests/ui/nll/user-annotations/cast_static_lifetime.stderr index 4599d04e7..3b9363c41 100644 --- a/tests/ui/nll/user-annotations/cast_static_lifetime.stderr +++ b/tests/ui/nll/user-annotations/cast_static_lifetime.stderr @@ -1,6 +1,8 @@ error[E0597]: `x` does not live long enough --> $DIR/cast_static_lifetime.rs:5:19 | +LL | let x = 22_u32; + | - binding `x` declared here LL | let y: &u32 = (&x) as &'static u32; | ^^^^---------------- | | diff --git a/tests/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr b/tests/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr index 12065a85a..f164255ef 100644 --- a/tests/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr +++ b/tests/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr @@ -1,6 +1,8 @@ error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:23:9 | +LL | let x = (); + | - binding `x` declared here LL | FUN(&x); | ----^^- | | | @@ -13,6 +15,9 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:24:23 | +LL | let x = (); + | - binding `x` declared here +LL | FUN(&x); LL | A::ASSOCIATED_FUN(&x); | ------------------^^- | | | @@ -25,6 +30,9 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:25:28 | +LL | let x = (); + | - binding `x` declared here +... LL | B::ALSO_ASSOCIATED_FUN(&x); | -----------------------^^- | | | @@ -37,6 +45,9 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:26:31 | +LL | let x = (); + | - binding `x` declared here +... LL | <_>::TRAIT_ASSOCIATED_FUN(&x); | --------------------------^^- | | | diff --git a/tests/ui/nll/user-annotations/fns.stderr b/tests/ui/nll/user-annotations/fns.stderr index e0640da39..8b53e138d 100644 --- a/tests/ui/nll/user-annotations/fns.stderr +++ b/tests/ui/nll/user-annotations/fns.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/fns.rs:23:29 | +LL | let c = 66; + | - binding `c` declared here LL | some_fn::<&'static u32>(&c); | ------------------------^^- | | | @@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; + | - binding `c` declared here LL | some_fn::<&'a u32>(&c); | -------------------^^- | | | diff --git a/tests/ui/nll/user-annotations/method-call.stderr b/tests/ui/nll/user-annotations/method-call.stderr index 10447e45a..3803cbf77 100644 --- a/tests/ui/nll/user-annotations/method-call.stderr +++ b/tests/ui/nll/user-annotations/method-call.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/method-call.rs:36:34 | +LL | let c = 66; + | - binding `c` declared here LL | a.method::<&'static u32>(b, &c); | -----------------------------^^- | | | @@ -15,6 +17,8 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here ... +LL | let c = 66; + | - binding `c` declared here LL | a.method::<&'a u32>(b, &c); | ------------------------^^- | | | diff --git a/tests/ui/nll/user-annotations/method-ufcs-1.stderr b/tests/ui/nll/user-annotations/method-ufcs-1.stderr index 962ddfd2b..c7c08c948 100644 --- a/tests/ui/nll/user-annotations/method-ufcs-1.stderr +++ b/tests/ui/nll/user-annotations/method-ufcs-1.stderr @@ -1,6 +1,9 @@ error[E0597]: `a` does not live long enough --> $DIR/method-ufcs-1.rs:30:7 | +LL | let a = 22; + | - binding `a` declared here +... LL | x(&a, b, c); | --^^------- | | | @@ -14,6 +17,8 @@ error[E0597]: `a` does not live long enough | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here +LL | let a = 22; + | - binding `a` declared here ... LL | <&'a u32 as Bazoom<_>>::method(&a, b, c); | -------------------------------^^------- diff --git a/tests/ui/nll/user-annotations/method-ufcs-2.stderr b/tests/ui/nll/user-annotations/method-ufcs-2.stderr index 63d59905e..b7861a3bd 100644 --- a/tests/ui/nll/user-annotations/method-ufcs-2.stderr +++ b/tests/ui/nll/user-annotations/method-ufcs-2.stderr @@ -1,6 +1,9 @@ error[E0597]: `a` does not live long enough --> $DIR/method-ufcs-2.rs:30:7 | +LL | let a = 22; + | - binding `a` declared here +... LL | x(&a, b, c); | --^^------- | | | @@ -14,7 +17,10 @@ error[E0597]: `b` does not live long enough | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here -... +LL | let a = 22; +LL | let b = 44; + | - binding `b` declared here +LL | let c = 66; LL | <_ as Bazoom<&'a u32>>::method(a, &b, c); | ----------------------------------^^---- | | | diff --git a/tests/ui/nll/user-annotations/method-ufcs-3.stderr b/tests/ui/nll/user-annotations/method-ufcs-3.stderr index e7851833e..8cb995a03 100644 --- a/tests/ui/nll/user-annotations/method-ufcs-3.stderr +++ b/tests/ui/nll/user-annotations/method-ufcs-3.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/method-ufcs-3.rs:36:53 | +LL | let c = 66; + | - binding `c` declared here LL | <_ as Bazoom<_>>::method::<&'static u32>(&a, b, &c); | ------------------------------------------------^^- | | | @@ -15,6 +17,8 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here ... +LL | let c = 66; + | - binding `c` declared here LL | <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); | -------------------------------------------^^- | | | diff --git a/tests/ui/nll/user-annotations/method-ufcs-inherent-1.stderr b/tests/ui/nll/user-annotations/method-ufcs-inherent-1.stderr index 94861babd..fb26b8d09 100644 --- a/tests/ui/nll/user-annotations/method-ufcs-inherent-1.stderr +++ b/tests/ui/nll/user-annotations/method-ufcs-inherent-1.stderr @@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let v = 22; + | - binding `v` declared here LL | let x = A::<'a>::new(&v, 22); | -------------^^----- | | | diff --git a/tests/ui/nll/user-annotations/method-ufcs-inherent-2.stderr b/tests/ui/nll/user-annotations/method-ufcs-inherent-2.stderr index 06f20d9b2..03b97447e 100644 --- a/tests/ui/nll/user-annotations/method-ufcs-inherent-2.stderr +++ b/tests/ui/nll/user-annotations/method-ufcs-inherent-2.stderr @@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let v = 22; + | - binding `v` declared here LL | let x = A::<'a>::new::<&'a u32>(&v, &v); | ------------------------^^----- | | | @@ -19,6 +20,7 @@ error[E0597]: `v` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let v = 22; + | - binding `v` declared here LL | let x = A::<'a>::new::<&'a u32>(&v, &v); | ----------------------------^^- | | | diff --git a/tests/ui/nll/user-annotations/method-ufcs-inherent-3.stderr b/tests/ui/nll/user-annotations/method-ufcs-inherent-3.stderr index 4ad61dc81..69dd1d1aa 100644 --- a/tests/ui/nll/user-annotations/method-ufcs-inherent-3.stderr +++ b/tests/ui/nll/user-annotations/method-ufcs-inherent-3.stderr @@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let v = 22; + | - binding `v` declared here LL | let x = <A<'a>>::new(&v, 22); | -------------^^----- | | | diff --git a/tests/ui/nll/user-annotations/method-ufcs-inherent-4.stderr b/tests/ui/nll/user-annotations/method-ufcs-inherent-4.stderr index 0f83e99cd..66d82bb49 100644 --- a/tests/ui/nll/user-annotations/method-ufcs-inherent-4.stderr +++ b/tests/ui/nll/user-annotations/method-ufcs-inherent-4.stderr @@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let v = 22; + | - binding `v` declared here LL | let x = <A<'a>>::new::<&'a u32>(&v, &v); | ------------------------^^----- | | | @@ -19,6 +20,7 @@ error[E0597]: `v` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let v = 22; + | - binding `v` declared here LL | let x = <A<'a>>::new::<&'a u32>(&v, &v); | ----------------------------^^- | | | diff --git a/tests/ui/nll/user-annotations/normalization.stderr b/tests/ui/nll/user-annotations/normalization.stderr index 975cb4b66..acc3a1800 100644 --- a/tests/ui/nll/user-annotations/normalization.stderr +++ b/tests/ui/nll/user-annotations/normalization.stderr @@ -1,6 +1,8 @@ error[E0597]: `a` does not live long enough --> $DIR/normalization.rs:10:31 | +LL | let a = 22; + | - binding `a` declared here LL | let _: <() as Foo>::Out = &a; | ---------------- ^^ borrowed value does not live long enough | | @@ -12,6 +14,8 @@ LL | } error[E0597]: `a` does not live long enough --> $DIR/normalization.rs:13:40 | +LL | let a = 22; + | - binding `a` declared here LL | let _: <&'static () as Foo>::Out = &a; | ------------------------- ^^ borrowed value does not live long enough | | diff --git a/tests/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr b/tests/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr index a97e7a9fd..3e7969e11 100644 --- a/tests/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr +++ b/tests/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr @@ -1,6 +1,8 @@ error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_brace_enum_variant.rs:7:33 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo::Bar { field: &y }; | ^^ borrowed value does not live long enough LL | @@ -12,6 +14,8 @@ LL | } error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_brace_enum_variant.rs:14:33 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo::Bar { field: &y }; | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr b/tests/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr index 408d7c2a5..89a1e9545 100644 --- a/tests/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr +++ b/tests/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr @@ -1,6 +1,8 @@ error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_brace_struct.rs:5:28 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo { field: &y }; | ^^ borrowed value does not live long enough LL | @@ -12,6 +14,8 @@ LL | } error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_brace_struct.rs:12:28 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo { field: &y }; | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr b/tests/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr index 920c906f6..8efeecc77 100644 --- a/tests/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr +++ b/tests/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr @@ -1,6 +1,8 @@ error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_tuple_enum_variant.rs:7:24 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo::Bar(&y); | ^^ borrowed value does not live long enough LL | @@ -12,6 +14,8 @@ LL | } error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_tuple_enum_variant.rs:14:24 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo::Bar(&y); | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr b/tests/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr index 3f01638d8..d7f1dac88 100644 --- a/tests/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr +++ b/tests/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr @@ -1,6 +1,8 @@ error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_tuple_struct.rs:5:19 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo(&y); | ^^ borrowed value does not live long enough LL | @@ -12,6 +14,8 @@ LL | } error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_tuple_struct.rs:12:19 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo(&y); | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/user-annotations/patterns.stderr b/tests/ui/nll/user-annotations/patterns.stderr index de6f8f80f..8bb714f1d 100644 --- a/tests/ui/nll/user-annotations/patterns.stderr +++ b/tests/ui/nll/user-annotations/patterns.stderr @@ -1,6 +1,8 @@ error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:6:9 | +LL | let x = 22; + | - binding `x` declared here LL | let y: &'static u32; | ------------ type annotation requires that `x` is borrowed for `'static` LL | y = &x; @@ -11,6 +13,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:14:9 | +LL | let x = 22; + | - binding `x` declared here LL | let (y, z): (&'static u32, &'static u32); | ---------------------------- type annotation requires that `x` is borrowed for `'static` LL | y = &x; @@ -21,6 +25,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:20:13 | +LL | let x = 22; + | - binding `x` declared here LL | let y = &x; | ^^ borrowed value does not live long enough LL | let ref z: &'static u32 = y; @@ -32,6 +38,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:39:9 | +LL | let x = 22; + | - binding `x` declared here LL | let Single { value: y }: Single<&'static u32>; | -------------------- type annotation requires that `x` is borrowed for `'static` LL | y = &x; @@ -42,6 +50,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:51:10 | +LL | let x = 22; + | - binding `x` declared here LL | let Single2 { value: mut _y }: Single2<StaticU32>; | ------------------ type annotation requires that `x` is borrowed for `'static` LL | _y = &x; @@ -52,6 +62,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:56:27 | +LL | let x = 22; + | - binding `x` declared here LL | let y: &'static u32 = &x; | ------------ ^^ borrowed value does not live long enough | | @@ -62,6 +74,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:61:27 | +LL | let x = 22; + | - binding `x` declared here LL | let _: &'static u32 = &x; | ------------ ^^ borrowed value does not live long enough | | @@ -100,6 +114,8 @@ LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44); error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:75:40 | +LL | let x = 22; + | - binding `x` declared here LL | let (_, _): (&'static u32, u32) = (&x, 44); | ------------------- ^^ borrowed value does not live long enough | | @@ -110,6 +126,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:80:40 | +LL | let x = 22; + | - binding `x` declared here LL | let (y, _): (&'static u32, u32) = (&x, 44); | ------------------- ^^ borrowed value does not live long enough | | @@ -120,6 +138,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:85:69 | +LL | let x = 22; + | - binding `x` declared here LL | let Single { value: y }: Single<&'static u32> = Single { value: &x }; | -------------------- ^^ borrowed value does not live long enough | | @@ -130,6 +150,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:90:69 | +LL | let x = 22; + | - binding `x` declared here LL | let Single { value: _ }: Single<&'static u32> = Single { value: &x }; | -------------------- ^^ borrowed value does not live long enough | | @@ -140,6 +162,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:98:17 | +LL | let x = 22; + | - binding `x` declared here LL | let Double { value1: _, value2: _ }: Double<&'static u32> = Double { | -------------------- type annotation requires that `x` is borrowed for `'static` LL | value1: &x, diff --git a/tests/ui/nll/user-annotations/promoted-annotation.stderr b/tests/ui/nll/user-annotations/promoted-annotation.stderr index cb99a6a36..132a00ba4 100644 --- a/tests/ui/nll/user-annotations/promoted-annotation.stderr +++ b/tests/ui/nll/user-annotations/promoted-annotation.stderr @@ -4,6 +4,7 @@ error[E0597]: `x` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let x = 0; + | - binding `x` declared here LL | let f = &drop::<&'a i32>; | ---------------- assignment requires that `x` is borrowed for `'a` LL | f(&x); diff --git a/tests/ui/nll/user-annotations/type_ascription_static_lifetime.stderr b/tests/ui/nll/user-annotations/type_ascription_static_lifetime.stderr index ccbf3c1d9..766877f88 100644 --- a/tests/ui/nll/user-annotations/type_ascription_static_lifetime.stderr +++ b/tests/ui/nll/user-annotations/type_ascription_static_lifetime.stderr @@ -1,6 +1,8 @@ error[E0597]: `x` does not live long enough --> $DIR/type_ascription_static_lifetime.rs:6:33 | +LL | let x = 22_u32; + | - binding `x` declared here LL | let y: &u32 = type_ascribe!(&x, &'static u32); | --------------^^--------------- | | | |