Skip to content

Commit 30b5452

Browse files
Remove the 'cfg' field from session::config::Options.
The 'cfg' in the Options struct is only the commandline-specified subset of the crate configuration and it's almost always wrong to read that instead of the CrateConfig in HIR crate node.
1 parent d2420c7 commit 30b5452

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

core.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ pub fn run_core(search_paths: SearchPaths,
119119
lint_cap: Some(lint::Allow),
120120
externs: externs,
121121
target_triple: triple.unwrap_or(config::host_triple().to_string()),
122-
cfg: config::parse_cfgspecs(cfgs),
123122
// Ensure that rustdoc works even if rustc is feature-staged
124123
unstable_features: UnstableFeatures::Allow,
125124
..config::basic_options().clone()
@@ -138,7 +137,7 @@ pub fn run_core(search_paths: SearchPaths,
138137
codemap, cstore.clone());
139138
rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
140139

141-
let mut cfg = config::build_configuration(&sess);
140+
let mut cfg = config::build_configuration(&sess, config::parse_cfgspecs(cfgs));
142141
target_features::add_configuration(&mut cfg, &sess);
143142

144143
let krate = panictry!(driver::phase_1_parse_input(&sess, cfg, &input));

test.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ pub fn run(input: &str,
9090
cstore.clone());
9191
rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
9292

93-
let mut cfg = config::build_configuration(&sess);
94-
cfg.extend(config::parse_cfgspecs(cfgs.clone()));
93+
let cfg = config::build_configuration(&sess, config::parse_cfgspecs(cfgs.clone()));
9594
let krate = panictry!(driver::phase_1_parse_input(&sess, cfg, &input));
9695
let driver::ExpansionResult { defs, mut hir_forest, .. } = {
9796
phase_2_configure_and_expand(
@@ -247,8 +246,7 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
247246
let outdir = Mutex::new(TempDir::new("rustdoctest").ok().expect("rustdoc needs a tempdir"));
248247
let libdir = sess.target_filesearch(PathKind::All).get_lib_path();
249248
let mut control = driver::CompileController::basic();
250-
let mut cfg = config::build_configuration(&sess);
251-
cfg.extend(config::parse_cfgspecs(cfgs.clone()));
249+
let cfg = config::build_configuration(&sess, config::parse_cfgspecs(cfgs.clone()));
252250
let out = Some(outdir.lock().unwrap().path().to_path_buf());
253251

254252
if no_run {

0 commit comments

Comments
 (0)