about summary refs log tree commit diff
path: root/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.stderr
blob: f02b65230b6ebfd0b10145f41081e807c7f3adbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
error: lifetime may not live long enough
  --> $DIR/ex3-both-anon-regions-one-is-struct-5.rs:10:5
   |
LL | fn bar(foo: &mut Foo) {
   |        ---  - let's call the lifetime of this reference `'1`
   |        |
   |        has type `&mut Foo<'2>`
LL |     foo.modify();
   |     ^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
   |
   = note: requirement occurs because of a mutable reference to `Foo<'_>`
   = note: mutable references are invariant over their type parameter
   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
help: consider introducing a named lifetime parameter
   |
LL | fn bar<'a>(foo: &'a mut Foo<'a>) {
   |       ++++       ++        ++++

error: aborting due to 1 previous error