|
| 1 | +error[E0382]: use of moved value: `var` |
| 2 | + --> $DIR/call-expr-incorrect-choice-diagnostics.rs:14:9 |
| 3 | + | |
| 4 | +LL | let mut var = item_bound_is_too_weak(); |
| 5 | + | ------- move occurs because `var` has type `{closure@$DIR/call-expr-incorrect-choice-diagnostics.rs:19:5: 19:12}`, which does not implement the `Copy` trait |
| 6 | +LL | var(); |
| 7 | + | ----- `var` moved due to this call |
| 8 | +LL | var(); |
| 9 | + | ^^^ value used here after move |
| 10 | + | |
| 11 | +note: this value implements `FnOnce`, which causes it to be moved when called |
| 12 | + --> $DIR/call-expr-incorrect-choice-diagnostics.rs:13:9 |
| 13 | + | |
| 14 | +LL | var(); |
| 15 | + | ^^^ |
| 16 | +help: consider cloning the value if the performance cost is acceptable |
| 17 | + | |
| 18 | +LL | var.clone()(); |
| 19 | + | ++++++++ |
| 20 | + |
| 21 | +error[E0618]: expected function, found `_` |
| 22 | + --> $DIR/call-expr-incorrect-choice-diagnostics.rs:24:9 |
| 23 | + | |
| 24 | +LL | fn opaque_type_no_impl_fn() -> impl Sized { |
| 25 | + | ----------------------------------------- `opaque_type_no_impl_fn` defined here returns `_` |
| 26 | +LL | if false { |
| 27 | +LL | opaque_type_no_impl_fn()(); |
| 28 | + | ^^^^^^^^^^^^^^^^^^^^^^^^-- |
| 29 | + | | |
| 30 | + | call expression requires function |
| 31 | + |
| 32 | +error[E0618]: expected function, found `_` |
| 33 | + --> $DIR/call-expr-incorrect-choice-diagnostics.rs:34:9 |
| 34 | + | |
| 35 | +LL | fn opaque_type_no_impl_fn_incorrect() -> impl Sized { |
| 36 | + | --------------------------------------------------- `opaque_type_no_impl_fn_incorrect` defined here returns `_` |
| 37 | +LL | if false { |
| 38 | +LL | opaque_type_no_impl_fn_incorrect()(); |
| 39 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-- |
| 40 | + | | |
| 41 | + | call expression requires function |
| 42 | + |
| 43 | +error[E0618]: expected function, found `_` |
| 44 | + --> $DIR/call-expr-incorrect-choice-diagnostics.rs:44:9 |
| 45 | + | |
| 46 | +LL | fn opaque_type_deref_no_impl_fn() -> impl Deref<Target = impl Sized> { |
| 47 | + | -------------------------------------------------------------------- `opaque_type_deref_no_impl_fn` defined here returns `_` |
| 48 | +LL | if false { |
| 49 | +LL | opaque_type_deref_no_impl_fn()(); |
| 50 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-- |
| 51 | + | | |
| 52 | + | call expression requires function |
| 53 | + |
| 54 | +error: aborting due to 4 previous errors |
| 55 | + |
| 56 | +Some errors have detailed explanations: E0382, E0618. |
| 57 | +For more information about an error, try `rustc --explain E0382`. |
0 commit comments