More refactorings to rustc_interface by bjorn3 · Pull Request #127184 · rust-lang/rust (original) (raw)
r? @Nadrieril
rustbot has assigned @Nadrieril.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r?
to explicitly pick a reviewer
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
This doesn't yet remove driver queries entirely as I'm not sure how to deal with the various finalization things in Compiler::enter
. Shifting the responsibility to call them to custom drivers seems like it would be forgotten too easily.
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 :>
Nadrieril added S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
and removed S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
labels
This comment has been minimized.
📌 Commit f276459 has been approved by Nadrieril
It is now in the queue for this repository.
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.
bors added S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
bors added a commit to rust-lang-ci/rust that referenced this pull request
…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
toverbose-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
toLanguageItems
, 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
bors added a commit to rust-lang-ci/rust that referenced this pull request
…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
toverbose-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
toLanguageItems
, 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
bors added a commit to rust-lang-ci/rust that referenced this pull request
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
bjorn3 deleted the interface_refactor2 branch
joboet added a commit to joboet/rust that referenced this pull request
…_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.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
…_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.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
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.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request
…=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.