about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorFabian Wolff <fabian.wolff@alumni.ethz.ch>2021-10-02 19:15:45 +0200
committerFabian Wolff <fabian.wolff@alumni.ethz.ch>2021-10-02 19:15:55 +0200
commit041212f8fbb9f52d41167448e4fbc2ce8cc7ee9a (patch)
treec13075331c74e7e216d5769ad0f2efa6984b60ec /compiler/rustc_interface/src
parented937594d3912ced11f6f35a90bb8bf591909d2a (diff)
downloadrust-041212f8fbb9f52d41167448e4fbc2ce8cc7ee9a.tar.gz
rust-041212f8fbb9f52d41167448e4fbc2ce8cc7ee9a.zip
Report fatal lexer errors in `--cfg` command line arguments
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/interface.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs
index 8393826aa12..3233887169c 100644
--- a/compiler/rustc_interface/src/interface.rs
+++ b/compiler/rustc_interface/src/interface.rs
@@ -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());