summaryrefslogtreecommitdiffstats
path: root/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr')
-rw-r--r--src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
new file mode 100644
index 000000000..1c9d0c835
--- /dev/null
+++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
@@ -0,0 +1,34 @@
+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<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('r) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed('s) }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('r) }) 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() {
+LL | | expect_sig(|a, b| b); // ought to return `a`
+LL | |
+LL | | }
+ | |_^
+ |
+ = note: defining type: test
+
+error: aborting due to previous error
+