-
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
Simplify query proc-macros #77830
Simplify query proc-macros #77830
Conversation
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
$(DepKind::$name => { | ||
debug_assert!(<$K as DepNodeParams<TyCtxt<'_>>>::can_reconstruct_query_key()); | ||
|
||
if let Some(key) = <$K as DepNodeParams<TyCtxt<'_>>>::recover(tcx, dep_node) { |
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.
Can the None
case happen here? Or does recover only return None
when can_reconstruct_query_key()
would return false?
I don't understand the code here, but it seems like a fragile interaction of different parts. I'd add an else { bug!() }
branch instead of the debug assert.
It's probably fine though, because the previous code did the same.
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.
recover
is implemented in terms of extract_def_id
, which uses def_path_hash_to_def_id.get(...)
, which can return None
.
Though this looks fine to me, I don't feel familiar enough with the query system to approve this. Sorry for taking so long to get to this. r? @oli-obk |
@bors r+ |
📌 Commit 57ba8ed has been approved by |
…as-schievink Rollup of 12 pull requests Successful merges: - rust-lang#75115 (`#[deny(unsafe_op_in_unsafe_fn)]` in sys/cloudabi) - rust-lang#76614 (change the order of type arguments on ControlFlow) - rust-lang#77610 (revise Hermit's mutex interface to support the behaviour of StaticMutex) - rust-lang#77830 (Simplify query proc-macros) - rust-lang#77930 (Do not ICE with TraitPredicates containing [type error]) - rust-lang#78069 (Fix const core::panic!(non_literal_str).) - rust-lang#78072 (Cleanup constant matching in exhaustiveness checking) - rust-lang#78119 (Throw core::panic!("message") as &str instead of String.) - rust-lang#78191 (Introduce a temporary for discriminant value in MatchBranchSimplification) - rust-lang#78272 (const_evaluatable_checked: deal with unused nodes + div) - rust-lang#78318 (TyCtxt: generate single impl block with `slice_interners` macro) - rust-lang#78327 (resolve: Relax macro resolution consistency check to account for any errors) Failed merges: r? `@ghost`
…ories, r=davidtwco Remove the remains of query categories Back in October 2020 in rust-lang#77830 `@cjgillot` removed the query categories information from the profiler, but the actual definitions which query was in which category remained, although unused. Here I clean that up, to simplify the query definitions even further. It's unfortunate that this loses all the context for `git blame`, ~~but I'm working on moving those query definitions into `rustc_query_system`, which will lose that context anyway.~~ EDIT: Might not work out. The functional changes are in the first commit. The second one only changes the indentation.
The query code generation is split between proc-macros and regular macros in
rustc_middle::ty::query
.This PR removes unused capabilities of the proc-macros, and tend to use regular macros for the logic.