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

Commit

Permalink
Merge pull request #1513 from Xanewok/collect-files-after-expansion
Browse files Browse the repository at this point in the history
Collect file -> edition mapping after AST expansion
  • Loading branch information
Xanewok authored Aug 4, 2019
2 parents 8ee1721 + 04ae465 commit d2cc327
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit d2cc327

Please sign in to comment.