Some more refactorings towards removing driver queries by bjorn3 · Pull Request #132410 · rust-lang/rust
rustbot
added
A-query-system
labels
Oct 31, 2024This was referenced
Oct 31, 2024This allows simplifying the call site and make_input by using a single match instead of two levels of if's.
bors
added
S-waiting-on-bors
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Nov 27, 2024joboet added a commit to joboet/rust that referenced this pull request
Nov 27, 2024…_round, r=cjgillot Some more refactorings towards removing driver queries Follow up to rust-lang#127184 ## Custom driver breaking change The `after_analysis` callback is changed to accept `TyCtxt` instead of `Queries`. The only safe query in `Queries` to call at this point is `global_ctxt()` which allows you to enter the `TyCtxt` either way. To fix your custom driver, replace the `queries: &'tcx Queries<'tcx>` argument with `tcx: TyCtxt<'tcx>` and remove your `queries.global_ctxt().unwrap().enter(|tcx| { ... })` call and only keep the contents of the closure. ## Custom driver deprecation The `after_crate_root_parsing` callback is now deprecated. Several custom drivers are incorrectly calling `queries.global_ctxt()` from inside of it, which causes some driver code to be skipped. As such I would like to either remove it in the future or if custom drivers still need it, change it to accept an `&rustc_ast::Crate` instead.
bors added a commit to rust-lang-ci/rust that referenced this pull request
Nov 27, 2024Rollup of 6 pull requests Successful merges: - rust-lang#116161 (Stabilize `extended_varargs_abi_support`) - rust-lang#132410 (Some more refactorings towards removing driver queries) - rust-lang#133418 (coverage: Store coverage source regions as `Span` until codegen) - rust-lang#133498 (Add missing code examples on `LocalKey`) - rust-lang#133518 (Structurally resolve before checking `!` in HIR typeck) - rust-lang#133521 (Structurally resolve before matching on type of projection) r? `@ghost` `@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request
Nov 28, 2024…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#132410 (Some more refactorings towards removing driver queries) - rust-lang#133418 (coverage: Store coverage source regions as `Span` until codegen) - rust-lang#133498 (Add missing code examples on `LocalKey`) - rust-lang#133518 (Structurally resolve before checking `!` in HIR typeck) - rust-lang#133521 (Structurally resolve before matching on type of projection) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Nov 28, 2024Rollup merge of rust-lang#132410 - bjorn3:yet_another_driver_refactor_round, r=cjgillot Some more refactorings towards removing driver queries Follow up to rust-lang#127184 ## Custom driver breaking change The `after_analysis` callback is changed to accept `TyCtxt` instead of `Queries`. The only safe query in `Queries` to call at this point is `global_ctxt()` which allows you to enter the `TyCtxt` either way. To fix your custom driver, replace the `queries: &'tcx Queries<'tcx>` argument with `tcx: TyCtxt<'tcx>` and remove your `queries.global_ctxt().unwrap().enter(|tcx| { ... })` call and only keep the contents of the closure. ## Custom driver deprecation The `after_crate_root_parsing` callback is now deprecated. Several custom drivers are incorrectly calling `queries.global_ctxt()` from inside of it, which causes some driver code to be skipped. As such I would like to either remove it in the future or if custom drivers still need it, change it to accept an `&rustc_ast::Crate` instead.
bjorn3
deleted the
yet_another_driver_refactor_round
branch
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
Dec 9, 2024A 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
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Dec 9, 2024Rollup 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
RalfJung pushed a commit to RalfJung/miri that referenced this pull request
Dec 9, 2024A 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/rust#132410
github-merge-queue bot pushed a commit to model-checking/kani that referenced this pull request
Dec 9, 2024label
Dec 10, 2024bjorn3 pushed a commit to rust-lang/rustc_codegen_cranelift that referenced this pull request
Dec 11, 2024A 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/rust#132410
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.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Dec 14, 2024Rollup 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.
christian-schilling pushed a commit to christian-schilling/rustc_codegen_cranelift that referenced this pull request
Jan 27, 2026A 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/rust#132410
christian-schilling pushed a commit to christian-schilling/rustc_codegen_cranelift that referenced this pull request
Jan 27, 2026A 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/rust#132410
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters