Files
rust/tests/ui/inference/ambiguous-numeric-in-closure-ref.stderr

30 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}`
--> $DIR/ambiguous-numeric-in-closure-ref.rs:6:35
|
LL | let _ = (0..10).filter(|&v| v.pow(2) > 0);
| - ^^^
| |
| you must specify a type for this binding
|
help: specify the type in the closure argument list
|
LL | let _ = (0..10).filter(|&v: &i32| v.pow(2) > 0);
| ++++++
error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}`
--> $DIR/ambiguous-numeric-in-closure-ref.rs:11:37
|
LL | let _ = v.iter().filter(|&&v| v.pow(2) > 0);
| - ^^^
| |
| you must specify a type for this binding
|
help: specify the type in the closure argument list
|
LL | let _ = v.iter().filter(|&&v: &&i32| v.pow(2) > 0);
| +++++++
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0689`.