mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
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.
This commit is contained in:
parent
e37f25aa3f
commit
878cfb5a4a
@ -223,7 +223,6 @@ fn run_compiler(
|
||||
file_loader: None,
|
||||
diagnostic_output,
|
||||
stderr: None,
|
||||
crate_name: None,
|
||||
lint_caps: Default::default(),
|
||||
register_lints: None,
|
||||
override_queries: None,
|
||||
@ -307,7 +306,6 @@ fn run_compiler(
|
||||
file_loader,
|
||||
diagnostic_output,
|
||||
stderr: None,
|
||||
crate_name: None,
|
||||
lint_caps: Default::default(),
|
||||
register_lints: None,
|
||||
override_queries: None,
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -1338,7 +1338,7 @@ pub fn build_session(
|
||||
|
||||
let profiler = SelfProfiler::new(
|
||||
directory,
|
||||
sopts.crate_name.as_ref().map(|s| &s[..]),
|
||||
sopts.crate_name.as_deref(),
|
||||
&sopts.debugging_opts.self_profile_events,
|
||||
);
|
||||
match profiler {
|
||||
|
@ -371,6 +371,7 @@ crate fn run_core(
|
||||
error_format,
|
||||
edition,
|
||||
describe_lints,
|
||||
crate_name,
|
||||
..Options::default()
|
||||
};
|
||||
|
||||
@ -384,7 +385,6 @@ crate fn run_core(
|
||||
file_loader: None,
|
||||
diagnostic_output: DiagnosticOutput::Default,
|
||||
stderr: None,
|
||||
crate_name,
|
||||
lint_caps,
|
||||
register_lints: None,
|
||||
override_queries: Some(|_sess, providers, _external_providers| {
|
||||
|
@ -74,6 +74,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
|
||||
debugging_opts: config::DebuggingOptions { ..config::basic_debugging_options() },
|
||||
edition: options.edition,
|
||||
target_triple: options.target.clone(),
|
||||
crate_name: options.crate_name.clone(),
|
||||
..config::Options::default()
|
||||
};
|
||||
|
||||
@ -90,7 +91,6 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
|
||||
file_loader: None,
|
||||
diagnostic_output: DiagnosticOutput::Default,
|
||||
stderr: None,
|
||||
crate_name: options.crate_name.clone(),
|
||||
lint_caps,
|
||||
register_lints: None,
|
||||
override_queries: None,
|
||||
|
@ -56,7 +56,6 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) {
|
||||
file_loader: None,
|
||||
diagnostic_output: DiagnosticOutput::Default,
|
||||
stderr: None,
|
||||
crate_name: None,
|
||||
lint_caps: Default::default(),
|
||||
register_lints: None,
|
||||
override_queries: None,
|
||||
|
Loading…
Reference in New Issue
Block a user