]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/as-ref-2.stderr
Rollup merge of #90666 - bdbai:arc_new_cyclic, r=m-ou-se
[rust.git] / src / test / ui / suggestions / as-ref-2.stderr
1 error[E0382]: use of moved value: `foo`
2   --> $DIR/as-ref-2.rs:12: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 LL |     let _y = foo;
9    |              ^^^ value used here after move
10    |
11 note: this function takes ownership of the receiver `self`, which moves `foo`
12   --> $SRC_DIR/core/src/option.rs:LL:COL
13    |
14 LL |     pub const fn map<U, F>(self, f: F) -> Option<U>
15    |                            ^^^^
16 help: consider calling `.as_ref()` to borrow the type's contents
17    |
18 LL |     let _x: Option<Struct> = foo.as_ref().map(|s| bar(&s));
19    |                                  +++++++++
20
21 error: aborting due to previous error
22
23 For more information about this error, try `rustc --explain E0382`.