-
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.
Rollup merge of #92569 - George-lewis:87181, r=estebank
Improve Error Messaging for Unconstructed Structs and Enum Variants in Generic Contexts Improves error messaging for empty-tuple structs and enum variants in certain generic contexts. See new ui tests for examples. Closes #87181
- Loading branch information
Showing
17 changed files
with
234 additions
and
30 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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
struct Bar<T> { | ||
bar: T | ||
} | ||
|
||
struct Foo(); | ||
impl Foo { | ||
fn foo() { } | ||
} | ||
|
||
fn main() { | ||
let thing = Bar { bar: Foo }; | ||
thing.bar.foo(); | ||
//~^ ERROR no method named `foo` found for fn item `fn() -> Foo {Foo}` in the current scope [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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error[E0599]: no method named `foo` found for fn item `fn() -> Foo {Foo}` in the current scope | ||
--> $DIR/empty-tuple-method.rs:12:15 | ||
| | ||
LL | thing.bar.foo(); | ||
| --------- ^^^ method not found in `fn() -> Foo {Foo}` | ||
| | | ||
| this is the constructor of a struct | ||
| | ||
help: call the constructor | ||
| | ||
LL | (thing.bar)().foo(); | ||
| + +++ | ||
|
||
error: aborting due to previous error | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
struct Bar<T> { | ||
bar: T | ||
} | ||
|
||
enum Foo{ | ||
Tup() | ||
} | ||
impl Foo { | ||
fn foo() { } | ||
} | ||
|
||
fn main() { | ||
let thing = Bar { bar: Foo::Tup }; | ||
thing.bar.foo(); | ||
//~^ ERROR no method named `foo` found for fn item `fn() -> Foo {Foo::Tup}` in the current scope [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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error[E0599]: no method named `foo` found for fn item `fn() -> Foo {Foo::Tup}` in the current scope | ||
--> $DIR/enum-variant.rs:14:15 | ||
| | ||
LL | thing.bar.foo(); | ||
| --------- ^^^ method not found in `fn() -> Foo {Foo::Tup}` | ||
| | | ||
| this is the constructor of an enum variant | ||
| | ||
help: call the constructor | ||
| | ||
LL | (thing.bar)().foo(); | ||
| + +++ | ||
|
||
error: aborting due to previous error | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
struct Bar<T> { | ||
bar: T | ||
} | ||
|
||
struct Foo(char, u16); | ||
impl Foo { | ||
fn foo() { } | ||
} | ||
|
||
fn main() { | ||
let thing = Bar { bar: Foo }; | ||
thing.bar.0; | ||
//~^ ERROR no field `0` on type `fn(char, u16) -> Foo {Foo}` [E0609] | ||
} |
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,16 @@ | ||
error[E0609]: no field `0` on type `fn(char, u16) -> Foo {Foo}` | ||
--> $DIR/tuple-field.rs:12:15 | ||
| | ||
LL | thing.bar.0; | ||
| --------- ^ | ||
| | | ||
| this is the constructor of a struct | ||
| | ||
help: call the constructor | ||
| | ||
LL | (thing.bar)(_, _).0; | ||
| + +++++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0609`. |
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,14 @@ | ||
struct Bar<T> { | ||
bar: T | ||
} | ||
|
||
struct Foo(u8, i32); | ||
impl Foo { | ||
fn foo() { } | ||
} | ||
|
||
fn main() { | ||
let thing = Bar { bar: Foo }; | ||
thing.bar.foo(); | ||
//~^ ERROR no method named `foo` found for fn item `fn(u8, i32) -> Foo {Foo}` in the current scope [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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error[E0599]: no method named `foo` found for fn item `fn(u8, i32) -> Foo {Foo}` in the current scope | ||
--> $DIR/tuple-method.rs:12:15 | ||
| | ||
LL | thing.bar.foo(); | ||
| --------- ^^^ method not found in `fn(u8, i32) -> Foo {Foo}` | ||
| | | ||
| this is the constructor of a struct | ||
| | ||
help: call the constructor | ||
| | ||
LL | (thing.bar)(_, _).foo(); | ||
| + +++++++ | ||
|
||
error: aborting due to previous error | ||
|
||
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