diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2020-11-30 22:54:20 -0500 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2020-12-01 12:54:03 -0500 |
| commit | 878cfb5a4abe70f6f813ae68216efe935ea40f5d (patch) | |
| tree | d9d7dcd96804858f49cb6e1ce906d9bb9448d43c /compiler/rustc_interface/src | |
| parent | e37f25aa3f356546ab851e394d5598fc575eabda (diff) | |
| download | rust-878cfb5a4abe70f6f813ae68216efe935ea40f5d.tar.gz rust-878cfb5a4abe70f6f813ae68216efe935ea40f5d.zip | |
Fix `unknown-crate` when using self-profile with rustdoc
... by removing a duplicate `crate_name` field in `interface::Config`, making it clear that rustdoc should be passing it to `config::Options` instead.
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/interface.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/queries.rs | 12 |
2 files changed, 5 insertions, 10 deletions
diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 11dd6ec32c0..acd49d86c2c 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -34,7 +34,6 @@ pub struct Compiler { pub(crate) input_path: Option<PathBuf>, pub(crate) output_dir: Option<PathBuf>, pub(crate) output_file: Option<PathBuf>, - pub(crate) crate_name: Option<String>, pub(crate) register_lints: Option<Box<dyn Fn(&Session, &mut LintStore) + Send + Sync>>, pub(crate) override_queries: Option<fn(&Session, &mut ty::query::Providers, &mut ty::query::Providers)>, @@ -140,7 +139,6 @@ pub struct Config { /// Set to capture stderr output during compiler execution pub stderr: Option<Arc<Mutex<Vec<u8>>>>, - pub crate_name: Option<String>, pub lint_caps: FxHashMap<lint::LintId, lint::Level>, /// This is a callback from the driver that is called when we're registering lints; @@ -185,7 +183,6 @@ pub fn create_compiler_and_run<R>(config: Config, f: impl FnOnce(&Compiler) -> R input_path: config.input_path, output_dir: config.output_dir, output_file: config.output_file, - crate_name: config.crate_name, register_lints: config.register_lints, override_queries: config.override_queries, }; diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index a2704c3adbf..4c340b3fc1f 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -156,13 +156,11 @@ impl<'tcx> Queries<'tcx> { pub fn crate_name(&self) -> Result<&Query<String>> { self.crate_name.compute(|| { - Ok(match self.compiler.crate_name { - Some(ref crate_name) => crate_name.clone(), - None => { - let parse_result = self.parse()?; - let krate = parse_result.peek(); - find_crate_name(self.session(), &krate.attrs, &self.compiler.input) - } + Ok({ + let parse_result = self.parse()?; + let krate = parse_result.peek(); + // parse `#[crate_name]` even if `--crate-name` was passed, to make sure it matches. + find_crate_name(self.session(), &krate.attrs, &self.compiler.input) }) }) } |
