about summary refs log tree commit diff
path: root/compiler/rustc_driver_impl/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-10-30 13:37:34 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-10-30 13:46:53 +1100
commit678e01a3fc1d21eb8ea4b281b3905c6d3340ce54 (patch)
tree06e1ea281ddfe5331632e904ed2fa55144578601 /compiler/rustc_driver_impl/src
parentec2b311914a4880235862f3cd65fe24e92e6d3a5 (diff)
downloadrust-678e01a3fc1d21eb8ea4b281b3905c6d3340ce54.tar.gz
rust-678e01a3fc1d21eb8ea4b281b3905c6d3340ce54.zip
Delay parsing of `--cfg` and `--check-cfg` options.
By storing the unparsed values in `Config` and then parsing them within
`run_compiler`, the parsing functions can use the main symbol interner,
and not create their own short-lived interners.

This change also eliminates the need for one `EarlyErrorHandler` in
rustdoc, because parsing errors can be reported by another, slightly
later `EarlyErrorHandler`.
Diffstat (limited to 'compiler/rustc_driver_impl/src')
-rw-r--r--compiler/rustc_driver_impl/src/lib.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs
index 37897b8d702..e4cb3fd25cd 100644
--- a/compiler/rustc_driver_impl/src/lib.rs
+++ b/compiler/rustc_driver_impl/src/lib.rs
@@ -317,13 +317,11 @@ fn run_compiler(
         return Ok(());
     }
 
-    let cfg = interface::parse_cfg(&early_error_handler, matches.opt_strs("cfg"));
-    let check_cfg = interface::parse_check_cfg(&early_error_handler, matches.opt_strs("check-cfg"));
     let (odir, ofile) = make_output(&matches);
     let mut config = interface::Config {
         opts: sopts,
-        crate_cfg: cfg,
-        crate_check_cfg: check_cfg,
+        crate_cfg: matches.opt_strs("cfg"),
+        crate_check_cfg: matches.opt_strs("check-cfg"),
         input: Input::File(PathBuf::new()),
         output_file: ofile,
         output_dir: odir,