rust/tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs
Nilstrieb ca79b82c6c Never consider int and float vars for FnPtr candidates
This solves a regression where `0.0.cmp()` was ambiguous when a custom
trait with a `cmp` method was in scope.

FOr integers it shouldn't be a problem in practice so I wasn't able to
add a test.
2023-04-03 15:25:06 +00:00

11 lines
199 B
Rust

// check-pass
trait MyCmp {
fn cmp(&self) {}
}
impl MyCmp for f32 {}
fn main() {
// Ensure that `impl<F: FnPtr> Ord for F` is never considered for int and float infer vars.
0.0.cmp();
}