forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#59821 - euclio:unknown-enum-variants, r=dav…
…idtwco improve unknown enum variant errors Fixes rust-lang#56517.
- Loading branch information
Showing
24 changed files
with
216 additions
and
99 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
enum Enum { Variant } | ||
|
||
impl Enum { | ||
const MISSPELLABLE: i32 = 0; | ||
fn misspellable() {} | ||
} | ||
|
||
trait Trait { | ||
fn misspellable_trait() {} | ||
} | ||
|
||
impl Trait for Enum { | ||
fn misspellable_trait() {} | ||
} | ||
|
||
fn main() { | ||
Enum::mispellable(); //~ ERROR no variant or associated item | ||
Enum::mispellable_trait(); //~ ERROR no variant or associated item | ||
Enum::MISPELLABLE; //~ ERROR no variant or associated item | ||
} |
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,36 @@ | ||
error[E0599]: no variant or associated item named `mispellable` found for type `Enum` in the current scope | ||
--> $DIR/associated-item-enum.rs:17:11 | ||
| | ||
LL | enum Enum { Variant } | ||
| --------- variant or associated item `mispellable` not found here | ||
... | ||
LL | Enum::mispellable(); | ||
| ^^^^^^^^^^^ | ||
| | | ||
| variant or associated item not found in `Enum` | ||
| help: there is a method with a similar name: `misspellable` | ||
|
||
error[E0599]: no variant or associated item named `mispellable_trait` found for type `Enum` in the current scope | ||
--> $DIR/associated-item-enum.rs:18:11 | ||
| | ||
LL | enum Enum { Variant } | ||
| --------- variant or associated item `mispellable_trait` not found here | ||
... | ||
LL | Enum::mispellable_trait(); | ||
| ^^^^^^^^^^^^^^^^^ variant or associated item not found in `Enum` | ||
|
||
error[E0599]: no variant or associated item named `MISPELLABLE` found for type `Enum` in the current scope | ||
--> $DIR/associated-item-enum.rs:19:11 | ||
| | ||
LL | enum Enum { Variant } | ||
| --------- variant or associated item `MISPELLABLE` not found here | ||
... | ||
LL | Enum::MISPELLABLE; | ||
| ^^^^^^^^^^^ | ||
| | | ||
| variant or associated item not found in `Enum` | ||
| help: there is an associated constant with a similar name: `MISSPELLABLE` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0599`. |
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
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
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
pub enum SomeEnum { | ||
B = SomeEnum::A, | ||
//~^ ERROR no variant named `A` found for type `SomeEnum` | ||
B = SomeEnum::A, //~ ERROR no variant or associated item named `A` found for type `SomeEnum` | ||
} | ||
|
||
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
Oops, something went wrong.