diff options
| author | bors <bors@rust-lang.org> | 2019-07-19 10:38:09 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-07-19 10:38:09 +0000 | 
| commit | 527dce7137f7a3c7bf47d9a503abf25f88ea22de (patch) | |
| tree | 1071f5c012fed4c0d1c47971cce00647f11a0f96 /src/libstd/sys_common/alloc.rs | |
| parent | f9477a77c52af8d3dea361b3f4ac3e60653aa529 (diff) | |
| parent | ff63336b65691f4fd0e339bb74a1798d1f96e86e (diff) | |
| download | rust-527dce7137f7a3c7bf47d9a503abf25f88ea22de.tar.gz rust-527dce7137f7a3c7bf47d9a503abf25f88ea22de.zip | |
Auto merge of #62679 - Xanewok:after-expansion, r=Zoxc
Add an `after_expansion` callback in the driver
To format a given file RLS needs to know the Rust edition associated with it. It's not enough to look at the `edition` key in Cargo.toml - each crate target can have a different edition associated with it so the sure way to fetch a correct edition is to scan the input files used to compile a given crate target.
Right now this was done in the `after_analysis` callback of our shim, however this leads to other problems - if a crate cannot be successfully compiled (e.g. it has a type error) then a callback would not be invoked meaning we can't populate the files -> edition mapping.
However, doing this only after parsing is not enough, since expansion can pull in additional source files (e.g. by invoking `macro_rules! include_my_mod { () => { mod some_mod; }; }`).
Without copy-pasting the entire driver setup it's also not possible to expand the crate ourselves in the `after_parsing` callback - to expand crate we'd need to register plugins and initialize session ourselves. However, this is done normally after executing the callback itself, thus triggering the `Once::set` assertions in `Session::init_features`.
r? @Zoxc
cc @RalfJung @oli-obk this affects public driver interface used by Miri and Clippy
Diffstat (limited to 'src/libstd/sys_common/alloc.rs')
0 files changed, 0 insertions, 0 deletions
