-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Allow instantiating object trait binder when upcasting #130866
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 |
---|---|---|
|
@@ -448,10 +448,10 @@ where | |
} | ||
} | ||
} else { | ||
self.delegate.enter_forall(kind, |kind| { | ||
let goal = goal.with(self.cx(), ty::Binder::dummy(kind)); | ||
self.add_goal(GoalSource::InstantiateHigherRanked, goal); | ||
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) | ||
self.enter_forall(kind, |ecx, kind| { | ||
let goal = goal.with(ecx.cx(), ty::Binder::dummy(kind)); | ||
ecx.add_goal(GoalSource::InstantiateHigherRanked, goal); | ||
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) | ||
}) | ||
} | ||
} | ||
|
@@ -840,12 +840,14 @@ where | |
self.delegate.instantiate_binder_with_infer(value) | ||
} | ||
|
||
/// `enter_forall`, but takes `&mut self` and passes it back through the | ||
/// callback since it can't be aliased during the call. | ||
pub(super) fn enter_forall<T: TypeFoldable<I> + Copy, U>( | ||
&self, | ||
&mut self, | ||
value: ty::Binder<I, T>, | ||
f: impl FnOnce(T) -> U, | ||
f: impl FnOnce(&mut Self, T) -> U, | ||
) -> U { | ||
self.delegate.enter_forall(value, f) | ||
self.delegate.enter_forall(value, |value| f(self, value)) | ||
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. given that While you're at it, change 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 remember there being a specific problem where we had an infectious &mut self that ended up changing quite a lot if we did 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. nvm, just needed to move an arg lol |
||
} | ||
|
||
pub(super) fn resolve_vars_if_possible<T>(&self, value: T) -> T | ||
|
Uh oh!
There was an error while loading. Please reload this page.