-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
--cfg parse failures produces hard to understand errors #31496
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
Type
Fields
Give feedbackNo fields configured for issues without a type.
rustc --cfg "a{" ../src/test/run-pass/hello.rsproduces:
It's clear that the way this is parsed is by constructing a fake source file and running it through the main parser. This is a confusing and ugly way to report these errors. Instead the errors should be converted to display in a way that makes it clear that what isn't parsing is the cfg provided on the command line. Perhaps like
Translating all possible parse errors to something that makes sense in a non-file context may be tricky, so this example does lose information about what the error was.
cc @nrc since you've done some parser refactoring recently.