-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an after_expansion
callback in the driver
#62679
Conversation
How hard is it to adjust existing drivers to the changed interface? Do we just have replace the |
Addressed the feedback. Is this good now? |
Yup, that's it! Figured it'd be more readable than bool, I found myself commenting // Continue execution
true so a |
@bors r+ |
📌 Commit ff63336 has been approved by |
⌛ Testing commit ff63336 with merge e8e0c666bad1a6e0af6a11fcff0db39a881e04a0... |
💔 Test failed - checks-azure |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Seems spurious? @bors retry |
⌛ Testing commit ff63336 with merge e1693a9700e87126a97497ccf3ccc582ed2231f4... |
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
☀️ Test successful - checks-azure |
📣 Toolstate changed by #62679! Tested on commit 527dce7. 💔 clippy-driver on windows: test-fail → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch, @rust-lang/infra). |
Tested on commit rust-lang/rust@527dce7. Direct link to PR: <rust-lang/rust#62679> 💔 clippy-driver on windows: test-fail → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch, @rust-lang/infra). 💔 clippy-driver on linux: test-fail → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch, @rust-lang/infra). 💔 miri on windows: test-fail → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra). 💔 miri on linux: test-fail → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra). 💔 rls on windows: test-pass → build-fail (cc @Xanewok, @rust-lang/infra). 💔 rls on linux: test-pass → build-fail (cc @Xanewok, @rust-lang/infra).
rustup rust-lang/rust#62679 changelog: none
Changes: ```` Fix breakage due to rust-lang#60913 Fix breakage due to rust-lang#62705 rustup rust-lang#62679 Update pulldown-cmark to 0.5.3 rustup rust-lang#62764 Format code Decrease maximum length for stderr files Improved imports Fix "unkown clippy lint" error in UI test. Corrections for PR review. Implement lint for inherent to_string() method. UI Test Cleanup: Extract match_ref_pats tests Update UI tests Allow no_effect lint Remove comment cargo fmt UI Test Cleanup: Split up checked_unwrap tests Removed lintining on never type. UI Test Cleanup: Split out out_of_bounds_indexing false positives fixes of `implicit_return` ````
Changes: ```` update test stderr, not sure which rustc pull request caused this. rustup rust-lang#62859 Fix tests for edition 2018 compatibility Revert "Revert global fmt config and use `rustfmt::skip`" Fix breakage due to rust-lang#60913 Fix breakage due to rust-lang#62705 Revert global fmt config and use `rustfmt::skip` Fix fmt rustup rust-lang#62679 Update pulldown-cmark to 0.5.3 rustup rust-lang#62764 Add test Format code Decrease maximum length for stderr files Improved imports Fix "unkown clippy lint" error in UI test. Corrections for PR review. Implement lint for inherent to_string() method. UI Test Cleanup: Extract match_ref_pats tests Update UI tests Allow no_effect lint Remove comment cargo fmt UI Test Cleanup: Split up checked_unwrap tests Removed lintining on never type. UI Test Cleanup: Split out out_of_bounds_indexing false positives fixes of `implicit_return` Ignore generated fresh lifetimes in elision check. ````
submodules: update clippy from 164310d to f8e04ff Changes: ```` update test stderr, not sure which rustc pull request caused this. rustup #62859 Fix tests for edition 2018 compatibility Revert "Revert global fmt config and use `rustfmt::skip`" Fix breakage due to #60913 Fix breakage due to #62705 Revert global fmt config and use `rustfmt::skip` Fix fmt rustup #62679 Update pulldown-cmark to 0.5.3 rustup #62764 Add test Format code Decrease maximum length for stderr files Improved imports Fix "unkown clippy lint" error in UI test. Corrections for PR review. Implement lint for inherent to_string() method. UI Test Cleanup: Extract match_ref_pats tests Update UI tests Allow no_effect lint Remove comment cargo fmt UI Test Cleanup: Split up checked_unwrap tests Removed lintining on never type. UI Test Cleanup: Split out out_of_bounds_indexing false positives fixes of `implicit_return` Ignore generated fresh lifetimes in elision check. ```` fixes clippy toolstate r? @Manishearth
Changes: ```` ci: temporarily disable rustfmt checks/tetss since it's broken for nightly rustup rust-lang#62964 Bump version of clippy_dummy update test stderr, not sure which rustc pull request caused this. rustup rust-lang#62859 Fix tests for edition 2018 compatibility Revert "Revert global fmt config and use `rustfmt::skip`" Fix breakage due to rust-lang#60913 Fix breakage due to rust-lang#62705 Revert global fmt config and use `rustfmt::skip` Fix fmt rustup rust-lang#62679 Update pulldown-cmark to 0.5.3 rustup rust-lang#62764 Add test Format code Decrease maximum length for stderr files Improved imports Fix "unkown clippy lint" error in UI test. Corrections for PR review. Implement lint for inherent to_string() method. UI Test Cleanup: Extract match_ref_pats tests Update UI tests Allow no_effect lint Remove comment cargo fmt UI Test Cleanup: Split up checked_unwrap tests Removed lintining on never type. UI Test Cleanup: Split out out_of_bounds_indexing false positives fixes of `implicit_return` Ignore generated fresh lifetimes in elision check. ````
submodules: update clippy from 164310d to dc69a5c Changes: ```` ci: temporarily disable rustfmt checks/tetss since it's broken for nightly rustup #62964 Bump version of clippy_dummy update test stderr, not sure which rustc pull request caused this. rustup #62859 Fix tests for edition 2018 compatibility Revert "Revert global fmt config and use `rustfmt::skip`" Fix breakage due to #60913 Fix breakage due to #62705 Revert global fmt config and use `rustfmt::skip` Fix fmt rustup #62679 Update pulldown-cmark to 0.5.3 rustup #62764 Add test Format code Decrease maximum length for stderr files Improved imports Fix "unkown clippy lint" error in UI test. Corrections for PR review. Implement lint for inherent to_string() method. UI Test Cleanup: Extract match_ref_pats tests Update UI tests Allow no_effect lint Remove comment cargo fmt UI Test Cleanup: Split up checked_unwrap tests Removed lintining on never type. UI Test Cleanup: Split out out_of_bounds_indexing false positives fixes of `implicit_return` Ignore generated fresh lifetimes in elision check. ```` fixes clippy toolstate r? @Manishearth
Update RLS and Rustfmt Supersedes rust-lang#62537. Closes rust-lang#62803. Fixes fallout after rust-lang#62679. r? @ghost
Update RLS Most importantly this includes: * Collect file -> edition mapping after AST expansion ([#1513](rust-lang/rls#1513)) (enabled by #62679) * Fix rustfmt during builds by reading edition from manifest ([#1533](rust-lang/rls#1533)) Which fixes the annoying problem where users couldn't format via RLS while `cargo fmt` worked. The beta cut-off is drawing near and I'd like to make sure this lands before then.
Changes: ```` ci: temporarily disable rustfmt checks/tetss since it's broken for nightly rustup rust-lang/rust#62964 Bump version of clippy_dummy update test stderr, not sure which rustc pull request caused this. rustup rust-lang/rust#62859 Fix tests for edition 2018 compatibility Revert "Revert global fmt config and use `rustfmt::skip`" Fix breakage due to rust-lang/rust#60913 Fix breakage due to rust-lang/rust#62705 Revert global fmt config and use `rustfmt::skip` Fix fmt rustup rust-lang/rust#62679 Update pulldown-cmark to 0.5.3 rustup rust-lang/rust#62764 Add test Format code Decrease maximum length for stderr files Improved imports Fix "unkown clippy lint" error in UI test. Corrections for PR review. Implement lint for inherent to_string() method. UI Test Cleanup: Extract match_ref_pats tests Update UI tests Allow no_effect lint Remove comment cargo fmt UI Test Cleanup: Split up checked_unwrap tests Removed lintining on never type. UI Test Cleanup: Split out out_of_bounds_indexing false positives fixes of `implicit_return` Ignore generated fresh lifetimes in elision check. ````
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 theOnce::set
assertions inSession::init_features
.r? @Zoxc
cc @RalfJung @oli-obk this affects public driver interface used by Miri and Clippy