]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/as-ref-2.stderr
Account for method call and indexing when looking for inner-most path in expression
[rust.git] / tests / ui / suggestions / as-ref-2.stderr
1 error[E0382]: use of moved value: `foo`
2   --> $DIR/as-ref-2.rs:10:14
3    |
4 LL |     let foo = Some(Struct);
5    |         --- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait
6 LL |     let _x: Option<Struct> = foo.map(|s| bar(&s));
7    |                              --- ---------------- `foo` moved due to this method call
8    |                              |
9    |                              help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
10 LL |     let _y = foo;
11    |              ^^^ value used here after move
12    |
13 note: `Option::<T>::map` takes ownership of the receiver `self`, which moves `foo`
14   --> $SRC_DIR/core/src/option.rs:LL:COL
15
16 error: aborting due to previous error
17
18 For more information about this error, try `rustc --explain E0382`.