-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-edition-2021Area: The 2021 editionArea: The 2021 editionA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.
Description
I tried this code:
#![allow(unused)]
#![warn(rust_2021_prelude_collisions)]
pub mod my_try {
pub trait MyTry: Sized {
fn try_from<V>(value: V) -> Result<Self, ()>;
}
}
use my_try::*;
struct Foo;
struct Bar;
impl MyTry for Bar {
fn try_from<V>(value: V) -> Result<Self, ()> {
unimplemented!()
}
}
pub fn foo() {
let x = Foo;
let y = Bar::try_from(x);
}
This has the suggestion to replace the code with:
let y = <Bar as >::try_from(x);
which is invalid syntax. The suggestion should be something like:
let y = <Bar as MyTry>::try_from(x);
Found in 2021 crater run for:
Meta
rustc --version --verbose
:
rustc 1.56.0-nightly (5eacec9ec 2021-08-28)
binary: rustc
commit-hash: 5eacec9ec7e112a0de1011519a57c45586d58414
commit-date: 2021-08-28
host: x86_64-apple-darwin
release: 1.56.0-nightly
LLVM version: 13.0.0
Metadata
Metadata
Assignees
Labels
A-edition-2021Area: The 2021 editionArea: The 2021 editionA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.