-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
A bunch of cleanups #133567
A bunch of cleanups #133567
Conversation
The Miri subtree was changed cc @rust-lang/miri Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #133568) made this pull request unmergeable. Please resolve the merge conflicts. |
1ccb4f8
to
00727eb
Compare
This comment has been minimized.
This comment has been minimized.
00727eb
to
83f5142
Compare
This comment has been minimized.
This comment has been minimized.
83f5142
to
8c0f39e
Compare
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #133956) made this pull request unmergeable. Please resolve the merge conflicts. |
And pass this to the individual emitters when necessary.
It was inconsistently done (sometimes even within a single function) and most of the rest of the compiler uses fatal errors instead, which need to be caught using catch_with_exit_code anyway. Using fatal errors instead of ErrorGuaranteed everywhere in the driver simplifies things a bit.
…ding delayed bugs
1bea2e5
to
85414eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 nits and r=me
@@ -446,23 +449,21 @@ fn run_compiler( | |||
return early_exit(); | |||
} | |||
|
|||
tcx.analysis(())?; | |||
let _ = tcx.analysis(()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use tcx.ensure().analysis(())
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The analysis
query returns a unit, so skipping returning of the query result doesn't save us anything. I think we do however need to make sure that the query gets executed (rather than just doing nothing if all dependencies are unchanged) to prevent query stealing from going wrong and I'm not sure if .ensure()
does that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
analysis
is eval_always, so yes, it will be re-executed in any case.
ensure()
is more about uniform style. When the return type is not (), let _ = some query
should always be replaced by ensure()
or ensure_with_value()
, to make meaning explicit.
if ppm.needs_analysis() && ex.tcx().analysis(()).is_err() { | ||
FatalError.raise(); | ||
if ppm.needs_analysis() { | ||
let _ = ex.tcx().analysis(()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use ensure()
.
@bors r=cjgillot |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#133567 (A bunch of cleanups) - rust-lang#133789 (Add doc alias 'then_with' for `then` method on `bool`) - rust-lang#133880 (Expand home_dir docs) - rust-lang#134036 (crash tests: use individual mir opts instead of mir-opt-level where easily possible) - rust-lang#134045 (Fix some triagebot mentions paths) - rust-lang#134046 (Remove ignored tests for hangs w/ new solver) - rust-lang#134050 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#133567 - bjorn3:various_cleanups, r=cjgillot A bunch of cleanups These are all extracted from a branch I have to get rid of driver queries. Most of the commits are not directly necessary for this, but were found in the process of implementing the removal of driver queries. Previous PR: rust-lang#132410
Upgrade toolchain to 12/12. The only substantive changes are for the 12/10 toolchain; 12/11 and 12/12 are just updating the LLBC tests. Culprit PR: rust-lang/rust#133567 (specifically [this commit](rust-lang/rust@401dd84) and [this commit](rust-lang/rust@030545d)). Resolves #3770 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
…l, r=oli-obk Stop using driver queries in the public API Follow up to rust-lang#132410 and rust-lang#133567 The next PR will completely get rid of driver queries. That PR will also contains some non-trivial refactorings enabled by no longer needing to support entering TyCtxt multiple times after it is constructed. The changes in the current PR have been split out to make it easier to review the api changes and to reduce the size of the next PR to review. ## Custom driver breaking change The `after_crate_root_parsing` and `after_expansion` callbacks now accept `ast::Crate` and `TyCtxt` respectively rather than `Queries`. The only safe query in `Queries` to call inside these callbacks are `parse()` and `global_ctxt()` respectively which allows you to access the `ast::Crate` and `TyCtxt` either way. To fix your custom driver, replace the `queries: &'tcx Queries<'tcx>` argument with `crate_: ast::Crate` and `tcx: TyCtxt<'tcx>` respectively and for `after_expansion` remove your `queries.global_ctxt().unwrap().enter(|tcx| { ... })` call and only keep the contents of the closure.
A bunch of cleanups (part 2) Just like rust-lang#133567 these were all found while looking at the respective code, but are not blocking any other changes I want to make in the short term.
Rollup merge of rust-lang#134130 - bjorn3:prepare_driver_query_removal, r=oli-obk Stop using driver queries in the public API Follow up to rust-lang#132410 and rust-lang#133567 The next PR will completely get rid of driver queries. That PR will also contains some non-trivial refactorings enabled by no longer needing to support entering TyCtxt multiple times after it is constructed. The changes in the current PR have been split out to make it easier to review the api changes and to reduce the size of the next PR to review. ## Custom driver breaking change The `after_crate_root_parsing` and `after_expansion` callbacks now accept `ast::Crate` and `TyCtxt` respectively rather than `Queries`. The only safe query in `Queries` to call inside these callbacks are `parse()` and `global_ctxt()` respectively which allows you to access the `ast::Crate` and `TyCtxt` either way. To fix your custom driver, replace the `queries: &'tcx Queries<'tcx>` argument with `crate_: ast::Crate` and `tcx: TyCtxt<'tcx>` respectively and for `after_expansion` remove your `queries.global_ctxt().unwrap().enter(|tcx| { ... })` call and only keep the contents of the closure.
A bunch of cleanups (part 2) Just like rust-lang#133567 these were all found while looking at the respective code, but are not blocking any other changes I want to make in the short term.
A bunch of cleanups (part 2) Just like rust-lang#133567 these were all found while looking at the respective code, but are not blocking any other changes I want to make in the short term.
Rollup merge of rust-lang#134251 - bjorn3:various_cleanups2, r=oli-obk A bunch of cleanups (part 2) Just like rust-lang#133567 these were all found while looking at the respective code, but are not blocking any other changes I want to make in the short term.
A bunch of cleanups (part 2) Just like rust-lang/rust#133567 these were all found while looking at the respective code, but are not blocking any other changes I want to make in the short term.
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#133567 (A bunch of cleanups) - rust-lang#133789 (Add doc alias 'then_with' for `then` method on `bool`) - rust-lang#133880 (Expand home_dir docs) - rust-lang#134036 (crash tests: use individual mir opts instead of mir-opt-level where easily possible) - rust-lang#134045 (Fix some triagebot mentions paths) - rust-lang#134046 (Remove ignored tests for hangs w/ new solver) - rust-lang#134050 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
A bunch of cleanups (part 2) Just like rust-lang/rust#133567 these were all found while looking at the respective code, but are not blocking any other changes I want to make in the short term.
These are all extracted from a branch I have to get rid of driver queries. Most of the commits are not directly necessary for this, but were found in the process of implementing the removal of driver queries.
Previous PR: #132410