diff --git a/changelog.md b/changelog.md index ecbe31614a5..cccabecde24 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,7 @@ - Support both owned and borrowed blacklisted crate names in `rls-analysis` - Publicly re-export `rls_analysis::raw::Crate` ### Changed +- Formatting project files now only needs project to parse and expand macros (and not type-check) - Converted remaining crates `rls-*` to 2018 edition ### Removed - Removed `use_crate_blacklist` setting in favour of `crate_blacklist` diff --git a/rls/src/build/rustc.rs b/rls/src/build/rustc.rs index 43c33daf990..27bb6354003 100644 --- a/rls/src/build/rustc.rs +++ b/rls/src/build/rustc.rs @@ -166,7 +166,7 @@ impl rustc_driver::Callbacks for RlsRustcCalls { Compilation::Continue } - fn after_analysis(&mut self, compiler: &interface::Compiler) -> Compilation { + fn after_expansion(&mut self, compiler: &interface::Compiler) -> Compilation { let sess = compiler.session(); let input = compiler.input(); let crate_name = compiler.crate_name().unwrap().peek().clone(); @@ -189,11 +189,20 @@ impl rustc_driver::Callbacks for RlsRustcCalls { }, }; + // We populate the file -> edition mapping only after expansion since it + // can pull additional input files let mut input_files = self.input_files.lock().unwrap(); for file in fetch_input_files(sess) { input_files.entry(file).or_default().insert(krate.clone()); } + Compilation::Continue + } + + fn after_analysis(&mut self, compiler: &interface::Compiler) -> Compilation { + let input = compiler.input(); + let crate_name = compiler.crate_name().unwrap().peek().clone(); + // Guaranteed to not be dropped yet in the pipeline thanks to the // `config.opts.debugging_opts.save_analysis` value being set to `true`. let expanded_crate = &compiler.expansion().unwrap().peek().0;