summary refs log tree commit diff stats
path: root/tests/ui/no_uaf_1.stderr
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/no_uaf_1.stderr')
-rw-r--r--tests/ui/no_uaf_1.stderr47
1 files changed, 13 insertions, 34 deletions
diff --git a/tests/ui/no_uaf_1.stderr b/tests/ui/no_uaf_1.stderr
index 6db82ed..af0d3e6 100644
--- a/tests/ui/no_uaf_1.stderr
+++ b/tests/ui/no_uaf_1.stderr
@@ -1,37 +1,16 @@
-error: lifetime may not live long enough
-  --> tests/ui/no_uaf_1.rs:25:17
+error[E0521]: borrowed data escapes outside of closure
+  --> tests/ui/no_uaf_1.rs:23:13
    |
-23 |           impl<'k, 'b> NewWith<'k, FooOpaque> for FooBuilder<'b> {
-   |                    -- lifetime `'b` defined here
-24 |               fn new_with<'a>(self) -> Foo<'a> where 'k: 'a {
-   |                           -- lifetime `'a` defined here
-25 | /                 Foo {
-26 | |                     x: "Hello".to_owned(),
-27 | |                     y: self.0,
-28 | |                 }
-   | |_________________^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+21 |           let rc_clone = rc.clone();
+   |               -------- `rc_clone` declared here, outside of the closure body
+22 |           let x = Holder::<'_, FooOpaque>::new_with(move |builder| {
+   |                                                           ------- `builder` is a reference that is only valid in the closure body
+23 | /             builder.build(Foo {
+24 | |                 x: "Hello".to_owned(),
+25 | |                 y: rc_clone,
+26 | |             });
+   | |______________^ `builder` escapes the closure body here
    |
-   = help: consider adding the following bound: `'b: 'a`
-   = note: requirement occurs because of the type `Foo<'_>`, which makes the generic argument `'_` invariant
-   = note: the struct `Foo<'a>` is invariant over the parameter `'a`
+   = note: requirement occurs because of a mutable reference to `selfref::Builder<'_, FooOpaque>`
+   = note: mutable references are invariant over their type parameter
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
-
-error: lifetime may not live long enough
-  --> tests/ui/no_uaf_1.rs:25:17
-   |
-23 |           impl<'k, 'b> NewWith<'k, FooOpaque> for FooBuilder<'b> {
-   |                    -- lifetime `'b` defined here
-24 |               fn new_with<'a>(self) -> Foo<'a> where 'k: 'a {
-   |                           -- lifetime `'a` defined here
-25 | /                 Foo {
-26 | |                     x: "Hello".to_owned(),
-27 | |                     y: self.0,
-28 | |                 }
-   | |_________________^ associated function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
-   |
-   = help: consider adding the following bound: `'a: 'b`
-   = note: requirement occurs because of the type `Foo<'_>`, which makes the generic argument `'_` invariant
-   = note: the struct `Foo<'a>` is invariant over the parameter `'a`
-   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
-
-help: `'b` and `'a` must be the same: replace one with the other