-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Recover from struct literals with placeholder path and suggest type f…
…rom expectation
- Loading branch information
Showing
9 changed files
with
128 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Regression test for issue #98282. | ||
|
||
mod blah { | ||
pub struct Stuff { x: i32 } | ||
pub fn do_stuff(_: Stuff) {} | ||
} | ||
|
||
fn main() { | ||
blah::do_stuff(_ { x: 10 }); | ||
//~^ ERROR the placeholder `_` is not allowed for the path in struct literals | ||
//~| NOTE not allowed in struct literals | ||
//~| HELP replace it with the correct type | ||
} | ||
|
||
#[cfg(FALSE)] | ||
fn disabled() { | ||
blah::do_stuff(_ { x: 10 }); | ||
//~^ ERROR the placeholder `_` is not allowed for the path in struct literals | ||
//~| NOTE not allowed in struct literals | ||
//~| HELP replace it with an appropriate type | ||
} |
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 @@ | ||
error: the placeholder `_` is not allowed for the path in struct literals | ||
--> $DIR/struct-lit-placeholder-path.rs:9:20 | ||
| | ||
LL | blah::do_stuff(_ { x: 10 }); | ||
| -^^^^^^^^^^ | ||
| | | ||
| not allowed in struct literals | ||
| help: replace it with the correct type: `Stuff` | ||
|
||
error: the placeholder `_` is not allowed for the path in struct literals | ||
--> $DIR/struct-lit-placeholder-path.rs:17:20 | ||
| | ||
LL | blah::do_stuff(_ { x: 10 }); | ||
| ^^^^^^^^^^^ | ||
| | | ||
| not allowed in struct literals | ||
| help: replace it with an appropriate type: `/*Type*/` | ||
|
||
error: aborting due to 2 previous errors | ||
|