summaryrefslogtreecommitdiffstats
path: root/src/test/ui/regions/regions-nested-fns.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/regions/regions-nested-fns.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/regions/regions-nested-fns.stderr')
-rw-r--r--src/test/ui/regions/regions-nested-fns.stderr52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/test/ui/regions/regions-nested-fns.stderr b/src/test/ui/regions/regions-nested-fns.stderr
new file mode 100644
index 000000000..bb2740310
--- /dev/null
+++ b/src/test/ui/regions/regions-nested-fns.stderr
@@ -0,0 +1,52 @@
+error[E0521]: borrowed data escapes outside of closure
+ --> $DIR/regions-nested-fns.rs:12:9
+ |
+LL | let mut ay = &y;
+ | ------ `ay` declared here, outside of the closure body
+...
+LL | ignore::<Box<dyn for<'z> FnMut(&'z isize)>>(Box::new(|z| {
+ | - `z` is a reference that is only valid in the closure body
+...
+LL | ay = z;
+ | ^^^^^^ `z` escapes the closure body here
+
+error[E0597]: `y` does not live long enough
+ --> $DIR/regions-nested-fns.rs:5:18
+ |
+LL | let mut ay = &y;
+ | ^^ borrowed value does not live long enough
+...
+LL | if false { return ay; }
+ | -- returning this value requires that `y` is borrowed for `'static`
+...
+LL | }
+ | - `y` dropped here while still borrowed
+
+error[E0597]: `y` does not live long enough
+ --> $DIR/regions-nested-fns.rs:10:15
+ |
+LL | ignore::<Box<dyn for<'z> FnMut(&'z isize)>>(Box::new(|z| {
+ | --- value captured here
+LL | ay = x;
+LL | ay = &y;
+ | ^ borrowed value does not live long enough
+...
+LL | if false { return ay; }
+ | -- returning this value requires that `y` is borrowed for `'static`
+...
+LL | }
+ | - `y` dropped here while still borrowed
+
+error: lifetime may not live long enough
+ --> $DIR/regions-nested-fns.rs:17:27
+ |
+LL | fn nested<'x>(x: &'x isize) {
+ | -- lifetime `'x` defined here
+...
+LL | if false { return x; }
+ | ^ returning this value requires that `'x` must outlive `'static`
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0521, E0597.
+For more information about an error, try `rustc --explain E0521`.