2020-03-04 21:03:15 -06:00
|
|
|
error[E0521]: borrowed data escapes outside of associated function
|
2019-01-27 05:03:21 -06:00
|
|
|
--> $DIR/issue-16683.rs:4:9
|
|
|
|
|
|
2021-10-03 15:25:26 -05:00
|
|
|
LL | trait T<'a> {
|
|
|
|
| -- lifetime `'a` defined here
|
|
|
|
LL | fn a(&'a self) -> &'a bool;
|
2019-01-27 05:03:21 -06:00
|
|
|
LL | fn b(&self) {
|
2021-10-03 15:25:26 -05:00
|
|
|
| -----
|
|
|
|
| |
|
|
|
|
| `self` is a reference that is only valid in the associated function body
|
|
|
|
| let's call the lifetime of this reference `'1`
|
2019-01-27 05:03:21 -06:00
|
|
|
LL | self.a();
|
2021-10-03 15:25:26 -05:00
|
|
|
| ^^^^^^^^
|
|
|
|
| |
|
|
|
|
| `self` escapes the associated function body here
|
|
|
|
| argument requires that `'1` must outlive `'a`
|
2019-01-27 05:03:21 -06:00
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|
2021-02-02 11:57:34 -06:00
|
|
|
For more information about this error, try `rustc --explain E0521`.
|