-
Notifications
You must be signed in to change notification settings - Fork 13.3k
avoid translating roots with predicates that do not hold #42797
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
Conversation
NOTE: I want to talk about this with @nikomatsakis to confirm this is the correct strategy - anyone else should not r+ this. |
friendly ping @nikomatsakis, pinging you in IRC too! |
src/librustc_trans/collector.rs
Outdated
@@ -304,6 +304,7 @@ fn collect_roots<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>, | |||
scx.tcx().hir.krate().visit_all_item_likes(&mut visitor); | |||
} | |||
|
|||
roots.retain(|root| root.is_instantiable(scx.tcx())); |
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.
Hmm. This seems perfectly reasonable, but perhaps not optimal? (Also, why do we check below for whether something is instantiable, but not other places?)
Put another way, it might be better to have some helper routine for pushing into self.output
that checks for "is instantiable" at that point -- perhaps this would also avoid enumerating the things reachable from a non-instantiable thing?
However, I see no obvious reason that this code is wrong.
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.
Everywhere except for roots and vtables, instantiability is guaranteed by the program type-checking, so we want to produce a clean ICE if the item is not instantiable.
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.
Aren't the roots just the content of the things pushed to self.output
?
As discussed on IRC, r=me w/ a comment. |
@bors r=nikomatsakis |
📌 Commit a6ca302 has been approved by |
avoid translating roots with predicates that do not hold Finally I got around to doing this. Fixes #37725. r? @nikomatsakis
☀️ Test successful - status-appveyor, status-travis |
Finally I got around to doing this.
Fixes #37725.
r? @nikomatsakis