Closed
Description
rustc --cfg "a{" ../src/test/run-pass/hello.rs
produces:
cfgspec:1:3: 1:3 error: this file contains an un-closed delimiter
cfgspec:1 a{
^
cfgspec:1:2: 1:3 help: did you mean to close this delimiter?
cfgspec:1 a{
^
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
error: invalid cfg spec passed on the command line: `a{`
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.