blob: 6db82ed6ee32993000c6355b631215fe9340bae7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
|