-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Don't opt_rpitit_info
as a separate query
#109057
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,7 +244,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { | |
} | ||
|
||
// Avoid accessing the HIR for the synthesized associated type generated for RPITITs. | ||
if self.tcx.opt_rpitit_info(id).is_some() { | ||
if self.tcx.opt_rpitit_info(id.to_def_id()).is_some() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what's makes the self.live_symbols.insert(id);
if let Some(node) = self.tcx.hir().find_by_def_id(id) {
self.visit_node(node);
} I'm not sure if there's any other situation where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this patch ... diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs
index 746cf488589..e76de89e432 100644
--- a/compiler/rustc_middle/src/hir/map/mod.rs
+++ b/compiler/rustc_middle/src/hir/map/mod.rs
@@ -316,7 +316,7 @@ pub fn find(self, id: HirId) -> Option<Node<'hir>> {
/// Retrieves the `Node` corresponding to `id`, returning `None` if cannot be found.
#[inline]
pub fn find_by_def_id(self, id: LocalDefId) -> Option<Node<'hir>> {
- self.find(self.local_def_id_to_hir_id(id))
+ self.find(self.tcx.opt_local_def_id_to_hir_id(id)?)
}
/// Retrieves the `Node` corresponding to `id`, panicking if it cannot be found.
diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs
index 73ee51d5f3a..1d713bbd055 100644
--- a/compiler/rustc_passes/src/dead.rs
+++ b/compiler/rustc_passes/src/dead.rs
@@ -243,18 +243,12 @@ fn mark_live_symbols(&mut self) {
continue;
}
- // Avoid accessing the HIR for the synthesized associated type generated for RPITITs.
- if self.tcx.opt_rpitit_info(id).is_some() {
- self.live_symbols.insert(id);
- continue;
- }
-
// in the case of tuple struct constructors we want to check the item, not the generated
// tuple struct constructor function
let id = self.struct_constructors.get(&id).copied().unwrap_or(id);
+ self.live_symbols.insert(id);
if let Some(node) = self.tcx.hir().find_by_def_id(id) {
- self.live_symbols.insert(id);
self.visit_node(node);
}
} all the tests pass. May worth running perf on this?. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That change seems orthogonal to this one -- this PR still demonstrates that we don't need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be clear, if we keep
There are 5 calls to |
||
self.live_symbols.insert(id); | ||
continue; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.