-
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
Queryify Vtable methods #45137
Queryify Vtable methods #45137
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
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.
Looks good! Left a few minor suggestions.
src/librustc/ty/maps/mod.rs
Outdated
@@ -227,6 +227,8 @@ define_maps! { <'tcx> | |||
[] fn item_body_nested_bodies: ItemBodyNestedBodies(DefId) -> ExternBodyNestedBodies, | |||
[] fn const_is_rvalue_promotable_to_static: ConstIsRvaluePromotableToStatic(DefId) -> bool, | |||
[] fn is_mir_available: IsMirAvailable(DefId) -> bool, | |||
[] fn vtable_methods: vtable_methods_node(ty::PolyTraitRef<'tcx>) | |||
-> Vec<Option<(DefId, &'tcx Substs<'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.
Returning Rc<Vec<Option<..>>>
would be better.
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.
Right! I had that change before, I should re-apply that patch.
src/librustc/traits/mod.rs
Outdated
@@ -650,12 +650,12 @@ pub fn normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, | |||
/// Given a trait `trait_ref`, iterates the vtable entries | |||
/// that come from `trait_ref`, including its supertraits. | |||
#[inline] // FIXME(#35870) Avoid closures being unexported due to impl Trait. | |||
pub fn get_vtable_methods<'a, 'tcx>( | |||
pub fn vtable_methods<'a, '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.
This need not be public anymore.
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.
🤦 Yep, Another one that I'll do real quick.
@nikomatsakis Thanks for the review. I corrected all of the minor suggestions. |
6225f8a
to
cb7e101
Compare
@bors r+ |
📌 Commit cb7e101 has been approved by |
⌛ Testing commit cb7e1016e48ca77277d82d427971c0988ccda497 with merge e66fd14c879d45c57f5c293e922a72de6b666a0d... |
💔 Test failed - status-travis |
I don't think this is my fault:
|
@bors retry
|
☔ The latest upstream changes (presumably #44967) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors r=nikomatsakis |
📌 Commit 09258e7 has been approved by |
Wait @bors r-
|
Well, the good is that I can reproduce the problem. The bad is that I have no idea why it's happening. |
It seems like the macro that implements the provider structure, |
@nikomatsakis @michaelwoerister This change set now includes a big change to plumbing.rs, which should be scrutinized. |
(tcx: $tcx:tt, | ||
input: (), | ||
output: ($(([$name:ident] [$K:ty] [$R:ty]))*)) => { | ||
input: ($(([$($modifiers:tt)*] [$name:ident] [$K:ty] [$R:ty]))*)) => { |
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.
This change looks fine. It does mean we lose the ability to have modifiers that adjust the type of a query's field. At present, we are not using this capability (we used to be...), so that's probably ok, but we could also just lift the recursion-limit, right?
I'm ok either way, but let's also rebase and remove the merge commit.
Rebasing. Just a moment. |
34cefbd
to
fcb8bc9
Compare
@nikomatsakis rebase complete. Merge commit removed. |
@bors r+ |
📌 Commit fcb8bc9 has been approved by |
…akis Queryify Vtable methods This query might come with a downside: It converts an iterator to a Vec, which may increase the working set of rustc on programs that use many many traits (I think that's where this is used).
☀️ Test successful - status-appveyor, status-travis |
🎉 |
This query might come with a downside: It converts an iterator to a Vec, which may increase the working set of rustc on programs that use many many traits (I think that's where this is used).