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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
474 B
Rust
Raw Normal View History

// Test for better error message when numeric type is ambiguous in closure parameter with reference
//@ run-rustfix
fn main() {
let _ = (0..10).filter(|&v: &i32| v.pow(2) > 0);
//~^ ERROR can't call method `pow` on ambiguous numeric type `{integer}`
//~| SUGGESTION &i32
let v = vec![0, 1, 2];
let _ = v.iter().filter(|&&v: &&i32| v.pow(2) > 0);
//~^ ERROR can't call method `pow` on ambiguous numeric type `{integer}`
//~| SUGGESTION &&i32
}