mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 21:15:18 +03:00
Rollup merge of #109896 - Nilstrieb:integers-are-not-fn-ptrs-remember-this-dear-transmuter, r=compiler-errors
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. I'm not sure whether there could be more issues hidden in the shadows as mentioned in the issue, but this should at least fix the problematic regression immediately. fixes #109892 r? oli-obk
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
// 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();
|
||||
}
|
||||
Reference in New Issue
Block a user