Closed
Description
I tried this code:
#![allow(unused)]
#![warn(future_prelude_collision)]
struct S;
impl S {
fn try_into(self) -> S { S }
}
fn main() {
let s = S;
let s2 = s.try_into();
}
I expected to see this happen: No warning
Instead, this happened: Got the warning:
warning: trait method `try_into` will become ambiguous in Rust 2021
--> src/main.rs:12:14
|
12 | let s2 = s.try_into();
| ^ help: disambiguate the method call: `(s)`
|
note: the lint level is defined here
--> src/main.rs:2:9
|
2 | #![warn(future_prelude_collision)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
= note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684>
AFAIK, this should not be ambiguous, since it is an inherent method, which should take priority over the TryInto trait. Also, the suggestion doesn't make much sense, since it just surrounds the variable with parenthesis, which have no effect (and indeed, can be removed even on 2021).
Meta
rustc 1.55.0-nightly (7c3872e6b 2021-06-24)
cc @m-ou-se