-
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
More refactorings to rustc_interface #127184
Conversation
r? @Nadrieril rustbot has assigned @Nadrieril. Use |
This doesn't yet remove driver queries entirely as I'm not sure how to deal with the various finalization things in |
This comment has been minimized.
This comment has been minimized.
Looks good, just a test to update. I'm curious: what do you mean by "remove driver queries"? |
The methods on https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/struct.Queries.html are what I call driver queries. Just like the queries in TyCtxt they are cached after their first call, but they are not serialized in the incr comp cache. They are purely interacted with by rustc_driver_impl and custom drivers. IMO they complicate things as it makes it easy for custom drivers to create the TyCtxt or HIR before the driver callback where you are supposed to access these, skipping various driver steps. In fact most custom drivers I have seen make this mistake at least once. |
I see, thanks! Pretty sure I've done that myself :> |
1e61697
to
5ad856f
Compare
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
5ad856f
to
f276459
Compare
Thanks! @bors r+ |
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
…ieril More refactorings to rustc_interface Follow up to rust-lang#126834
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#126403 (Actually report normalization-based type errors correctly for alias-relate obligations in new solver) - rust-lang#126803 (Change `asm-comments` to `verbose-asm`, always emit user comments) - rust-lang#126917 (Disable rmake test `inaccessible-temp-dir` on riscv64) - rust-lang#127050 (Make mtime of reproducible tarballs dependent on git commit) - rust-lang#127145 (Add `as_lang_item` to `LanguageItems`, new trait solver) - rust-lang#127184 (More refactorings to rustc_interface) - rust-lang#127202 (Remove global error count checks from typeck) - rust-lang#127233 (Some parser cleanups) - rust-lang#127245 (Add a test for `generic_const_exprs`) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#126403 (Actually report normalization-based type errors correctly for alias-relate obligations in new solver) - rust-lang#126803 (Change `asm-comments` to `verbose-asm`, always emit user comments) - rust-lang#126917 (Disable rmake test `inaccessible-temp-dir` on riscv64) - rust-lang#127050 (Make mtime of reproducible tarballs dependent on git commit) - rust-lang#127145 (Add `as_lang_item` to `LanguageItems`, new trait solver) - rust-lang#127184 (More refactorings to rustc_interface) - rust-lang#127202 (Remove global error count checks from typeck) - rust-lang#127233 (Some parser cleanups) - rust-lang#127245 (Add a test for `generic_const_exprs`) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#127092 (Change return-type-notation to use `(..)`) - rust-lang#127184 (More refactorings to rustc_interface) - rust-lang#127190 (Update LLVM submodule) - rust-lang#127253 (Fix incorrect suggestion for extra argument with a type error) - rust-lang#127280 (Disable rmake test rustdoc-io-error on riscv64gc-gnu) - rust-lang#127294 (Less magic number for corountine) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#127184 - bjorn3:interface_refactor2, r=Nadrieril More refactorings to rustc_interface Follow up to rust-lang#126834
…_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.
…_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.
Rollup 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.
…=cjgillot Some more refactorings towards removing driver queries Follow up to rust-lang/rust#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.
Follow up to #126834