Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Collect file -> edition mapping after AST expansion #1513

Merged
merged 2 commits into from Aug 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Expand Up @@ -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`
Expand Down
11 changes: 10 additions & 1 deletion rls/src/build/rustc.rs
Expand Up @@ -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();
Expand All @@ -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;
Expand Down