-
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
Remove interior mutability from TraitDef by turning fields into queries #41911
Changes from all commits
c2d9b4e
513cc6d
77b7df3
8da2fe8
40a6734
742ebc1
d731b04
0a77a58
42051ce
08660af
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 |
---|---|---|
|
@@ -619,8 +619,6 @@ pub fn get_vtable_methods<'a, 'tcx>( | |
debug!("get_vtable_methods({:?})", trait_ref); | ||
|
||
supertraits(tcx, trait_ref).flat_map(move |trait_ref| { | ||
tcx.populate_implementations_for_trait_if_necessary(trait_ref.def_id()); | ||
|
||
let trait_methods = tcx.associated_items(trait_ref.def_id()) | ||
.filter(|item| item.kind == ty::AssociatedKind::Method); | ||
|
||
|
@@ -782,3 +780,19 @@ impl<'tcx> TraitObligation<'tcx> { | |
ty::Binder(self.predicate.skip_binder().self_ty()) | ||
} | ||
} | ||
|
||
pub fn provide(providers: &mut ty::maps::Providers) { | ||
*providers = ty::maps::Providers { | ||
is_object_safe: object_safety::is_object_safe_provider, | ||
specialization_graph_of: specialize::specialization_graph_provider, | ||
..*providers | ||
}; | ||
} | ||
|
||
pub fn provide_extern(providers: &mut ty::maps::Providers) { | ||
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. Since they're identical I'd use the same function twice. 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. You think so? It's just a coincidence that they are identical at the moment. 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. maybe have 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 makes sense. |
||
*providers = ty::maps::Providers { | ||
is_object_safe: object_safety::is_object_safe_provider, | ||
specialization_graph_of: specialize::specialization_graph_provider, | ||
..*providers | ||
}; | ||
} |
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.
I'm curious why you converted this into a single dep-node, rather than keeping it per-trait. It seems like this is losing quite a bit of precision, no?
(That is, if any trait adds an impl, we will consider them all to have changed.)
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.
Mostly for ease of implementation and symmetry with the situation in metadata.
DepNode::TraitImpls
has been re-purposed to represent local and remote impls and, with red-green, will take care of stopping invalidation short.Without red-green though you are right, it's losing precision. Want me to make it per-item?
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.
Probably not a big deal.