]> git.lizzy.rs Git - rust.git/blob - tests/ui/match/match-ref-mut-let-invariance.stderr
Auto merge of #106812 - oli-obk:output_filenames, r=petrochenkov
[rust.git] / tests / ui / match / match-ref-mut-let-invariance.stderr
1 error: lifetime may not live long enough
2   --> $DIR/match-ref-mut-let-invariance.rs:11:9
3    |
4 LL | impl<'b> S<'b> {
5    |      -- lifetime `'b` defined here
6 LL |     fn bar<'a>(&'a mut self) -> &'a mut &'a i32 {
7    |            -- lifetime `'a` defined here
8 LL |         let ref mut x = self.0;
9 LL |         x
10    |         ^ associated function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
11    |
12    = help: consider adding the following bound: `'a: 'b`
13    = note: requirement occurs because of a mutable reference to `&i32`
14    = note: mutable references are invariant over their type parameter
15    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
16
17 error: aborting due to previous error
18