diff options
Diffstat (limited to 'tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr')
-rw-r--r-- | tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr new file mode 100644 index 000000000..6db72b886 --- /dev/null +++ b/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr @@ -0,0 +1,31 @@ +note: no external requirements + --> $DIR/return-wrong-bound-region.rs:11:16 + | +LL | expect_sig(|a, b| b); // ought to return `a` + | ^^^^^^ + | + = note: defining type: test::{closure#0} with closure substs [ + i16, + for<Region(BrAnon(0, None)), Region(BrAnon(1, None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) i32, + (), + ] + +error: lifetime may not live long enough + --> $DIR/return-wrong-bound-region.rs:11:23 + | +LL | expect_sig(|a, b| b); // ought to return `a` + | - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | | | + | | has type `&'1 i32` + | has type `&'2 i32` + +note: no external requirements + --> $DIR/return-wrong-bound-region.rs:10:1 + | +LL | fn test() { + | ^^^^^^^^^ + | + = note: defining type: test + +error: aborting due to previous error + |