Open
Description
I tried this code:
struct A;
mod inner {
struct A;
impl From<super::A> for A {}
impl From<A> for super::A {}
}
I expected to see this happen: an error suggesting the following code:
struct A;
mod inner {
struct A;
impl From<super::A> for A { fn from(_: super::A) -> Self { todo!() } }
impl From<A> for super::A { fn from(_: A) -> Self { todo!() } }
}
Instead, this happened: an error suggested the following (incorrect) code:
struct A;
mod inner {
struct A;
impl From<super::A> for A { fn from(_: A) -> Self { todo!() } }
impl From<A> for super::A { fn from(_: inner::A) -> Self { todo!() } }
}
error[E0046]: not all trait items implemented, missing: `from`
--> ./t.rs:6:5
|
6 | impl From<super::A> for A {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `from` in implementation
|
= help: implement the missing item: `fn from(_: A) -> Self { todo!() }`
error[E0046]: not all trait items implemented, missing: `from`
--> ./t.rs:7:5
|
7 | impl From<A> for super::A {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `from` in implementation
|
= help: implement the missing item: `fn from(_: inner::A) -> Self { todo!() }`
Meta
rustc --version --verbose
:
rustc 1.74.1 (a28077b28 2023-12-04)
binary: rustc
commit-hash: a28077b28a02b92985b3a3faecf92813155f1ea1
commit-date: 2023-12-04
host: x86_64-unknown-linux-gnu
release: 1.74.1
LLVM version: 17.0.4
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Category: This is a bug.Diagnostics: A structured suggestion resulting in incorrect code.Relevant to the compiler team, which will review and decide on the PR/issue.Working group: Diagnostics