-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #79772 - ethanboxx:79760-wrongly-speaks-of-methods, r=o…
…li-obk smarter E0390 Should fix #79760 I am fairly new to the compiler so am hoping I did things correctly :).
- Loading branch information
Showing
6 changed files
with
122 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// ignore-tidy-linelength | ||
|
||
|
||
impl u8 { | ||
//~^ error: only a single inherent implementation marked with `#[lang = "u8"]` is allowed for the `u8` primitive | ||
pub const B: u8 = 0; | ||
} | ||
|
||
impl str { | ||
//~^ error: only a single inherent implementation marked with `#[lang = "str"]` is allowed for the `str` primitive | ||
fn foo() {} | ||
fn bar(self) {} | ||
} | ||
|
||
impl char { | ||
//~^ error: only a single inherent implementation marked with `#[lang = "char"]` is allowed for the `char` primitive | ||
pub const B: u8 = 0; | ||
pub const C: u8 = 0; | ||
fn foo() {} | ||
fn bar(self) {} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
error[E0390]: only a single inherent implementation marked with `#[lang = "u8"]` is allowed for the `u8` primitive | ||
--> $DIR/kinds-of-primitive-impl.rs:4:1 | ||
| | ||
LL | / impl u8 { | ||
LL | | | ||
LL | | pub const B: u8 = 0; | ||
LL | | } | ||
| |_^ | ||
| | ||
= help: consider using a trait to implement this constant | ||
|
||
error[E0390]: only a single inherent implementation marked with `#[lang = "str"]` is allowed for the `str` primitive | ||
--> $DIR/kinds-of-primitive-impl.rs:9:1 | ||
| | ||
LL | / impl str { | ||
LL | | | ||
LL | | fn foo() {} | ||
LL | | fn bar(self) {} | ||
LL | | } | ||
| |_^ | ||
| | ||
= help: consider using a trait to implement these methods | ||
|
||
error[E0390]: only a single inherent implementation marked with `#[lang = "char"]` is allowed for the `char` primitive | ||
--> $DIR/kinds-of-primitive-impl.rs:15:1 | ||
| | ||
LL | / impl char { | ||
LL | | | ||
LL | | pub const B: u8 = 0; | ||
LL | | pub const C: u8 = 0; | ||
LL | | fn foo() {} | ||
LL | | fn bar(self) {} | ||
LL | | } | ||
| |_^ | ||
| | ||
= help: consider using a trait to implement these associated items | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0390`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters