summary refs log blame commit diff stats
path: root/tests/ui/no_uaf_1.stderr
blob: 6db82ed6ee32993000c6355b631215fe9340bae7 (plain) (tree)




































                                                                                                                                       
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