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.stderr37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/ui/no_uaf_1.stderr b/tests/ui/no_uaf_1.stderr
new file mode 100644
index 0000000..6db82ed
--- /dev/null
+++ b/tests/ui/no_uaf_1.stderr
@@ -0,0 +1,37 @@
+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 `'a` but it is returning data with lifetime `'b`
+   |
+   = 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`
+   = 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