Closed
Description
Code
impl From<()> for () {
fn from(_: ()) {}
}
Current output
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> src/lib.rs:1:1
|
1 | impl From<()> for () {
| ^^^^^--------^^^^^--
| | | |
| | | this is not defined in the current crate because tuples are always foreign
| | this is not defined in the current crate because this is a foreign trait
| impl doesn't use only types from inside the current crate
|
= note: define and implement a trait or new type instead
Desired output
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> src/lib.rs:1:1
|
1 | impl From<()> for () {
| ^^^^^--------^^^^^--
| | | |
| | | this is not defined in the current crate because tuples are always foreign
| | this is not defined in the current crate because this is a foreign trait
| impl doesn't use any uncovered types from inside the current crate
|
= note: define and implement a trait or new type instead
Rationale and extra context
No response
Other cases
No response
Rust Version
Build using the Nightly version: 1.81.0-nightly(2024-07-12 c6727fc9b5c64cefa726) on the playground
Anything else?
The relevant line is here rustc_hir_analysis/messages.ftl#L354