Skip to content

[pull] master from rust-lang:master#173

Merged
pull[bot] merged 3 commits intoMattlk13:masterfrom
rust-lang:master
Jul 19, 2019
Merged

[pull] master from rust-lang:master#173
pull[bot] merged 3 commits intoMattlk13:masterfrom
rust-lang:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull bot commented Jul 19, 2019

See Commits and Changes for more details.


Created by pull[bot]. Want to support this open source service? Please star it : )


This change is Reviewable

Xanewok and others added 3 commits July 15, 2019 16:53
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
@pull pull bot added the ⤵️ pull label Jul 19, 2019
@pull pull bot merged commit 527dce7 into Mattlk13:master Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants