A bunch of cleanups by bjorn3 · Pull Request #133567 · rust-lang/rust

@rustbot rustbot added A-query-system

Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)

S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

T-rustdoc

Relevant to the rustdoc team, which will review and decide on the PR/issue.

labels

Nov 28, 2024

oli-obk

oli-obk

@bjorn3

@bjorn3

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.

@bjorn3

@bjorn3

cjgillot

@bjorn3

@bjorn3

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Dec 9, 2024
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

@bjorn3 bjorn3 deleted the various_cleanups branch

December 9, 2024 06:47

github-merge-queue bot pushed a commit to model-checking/kani that referenced this pull request

Dec 13, 2024
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.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Dec 13, 2024
…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.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Dec 13, 2024
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.

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Dec 14, 2024
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.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Dec 14, 2024
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.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Dec 14, 2024
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.

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Dec 14, 2024
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.

github-actions bot pushed a commit to rust-lang/miri that referenced this pull request

Dec 15, 2024
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.

smoelius added a commit to trailofbits/dylint that referenced this pull request

Dec 15, 2024

smoelius added a commit to trailofbits/dylint that referenced this pull request

Dec 15, 2024

smoelius added a commit to trailofbits/dylint that referenced this pull request

Dec 15, 2024

flip1995 pushed a commit to flip1995/rust that referenced this pull request

Dec 15, 2024

smoelius added a commit to trailofbits/dylint that referenced this pull request

Dec 16, 2024

bjorn3 pushed a commit to rust-lang/rustc_codegen_cranelift that referenced this pull request

Dec 18, 2024
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.

bors pushed a commit to rust-lang-ci/rust that referenced this pull request

Jan 5, 2025
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

copybara-service bot pushed a commit to google/crubit that referenced this pull request

Jan 14, 2025
These failures were previously communicated using Result values that
returned an ErrorGuaranteed in the error variant.
rust-lang/rust#133567 changed these Result
returns into immediate panics in more cases.

PiperOrigin-RevId: 715552263
Change-Id: Idf544a22e24d1ea7b13768f056685ece5df709d1

github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this pull request

Mar 11, 2025

christian-schilling pushed a commit to christian-schilling/rustc_codegen_cranelift that referenced this pull request

Jan 27, 2026
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.

christian-schilling pushed a commit to christian-schilling/rustc_codegen_cranelift that referenced this pull request

Jan 27, 2026
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.

rust-bors bot pushed a commit that referenced this pull request

Feb 27, 2026
Rollup of 7 pull requests

Successful merges:

 - #133567 (A bunch of cleanups)
 - #133789 (Add doc alias 'then_with' for `then` method on `bool`)
 - #133880 (Expand home_dir docs)
 - #134036 (crash tests: use individual mir opts instead of mir-opt-level where easily possible)
 - #134045 (Fix some triagebot mentions paths)
 - #134046 (Remove ignored tests for hangs w/ new solver)
 - #134050 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup