File: associated-types-outlives.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie, trixie-backports, trixie-proposed-updates
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (25 lines) | stat: -rw-r--r-- 1,032 bytes parent folder | download | duplicates (13)
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
error[E0505]: cannot move out of `x` because it is borrowed
  --> $DIR/associated-types-outlives.rs:22:14
   |
LL |                     F: for<'a> FnOnce(<T as Foo<'a>>::Bar)>(x: T, f: F) {
   |                                                             - binding `x` declared here
...
LL |         's: loop { y = denormalise(&x); break }
   |                                    -- borrow of `x` occurs here
LL |         drop(x);
   |              ^ move out of `x` occurs here
LL |         return f(y);
   |                  - borrow later used here
   |
help: if `T` implemented `Clone`, you could clone the value
  --> $DIR/associated-types-outlives.rs:17:21
   |
LL | pub fn free_and_use<T: for<'a> Foo<'a>,
   |                     ^ consider constraining this type parameter with `Clone`
...
LL |         's: loop { y = denormalise(&x); break }
   |                                     - you could clone this value

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0505`.