Report fatal lexer errors in --cfg command line arguments

This commit is contained in:
Fabian Wolff 2021-10-02 19:15:45 +02:00
parent ed937594d3
commit 041212f8fb
5 changed files with 37 additions and 7 deletions

View file

@ -81,7 +81,10 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String
let cfg = cfgspecs
.into_iter()
.map(|s| {
let sess = ParseSess::with_silent_emitter();
let sess = ParseSess::with_silent_emitter(Some(format!(
"this error occurred on the command line: `--cfg={}`",
s
)));
let filename = FileName::cfg_spec_source_code(&s);
let mut parser = new_parser_from_source_str(&sess, filename, s.to_string());