-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Split SelectionContext::select
into fns that take a binder and don't
#113308
Conversation
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
let bound_predicate = obligation.predicate.kind(); | ||
let trait_pred = match bound_predicate.skip_binder() { | ||
ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_pred)) | ||
let trait_pred = match obligation.predicate.kind().no_bound_vars() { |
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 could technically affect inference, but CoerceUnsized
is an unstable trait and I don't know of a stdlib impl that emits bound predicates :^)
☔ The latest upstream changes (presumably #113370) made this pull request unmergeable. Please resolve the merge conflicts. |
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.
some nits, then r=me
@@ -292,7 +292,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { | |||
new_env, | |||
pred, | |||
)); | |||
let result = select.select(&obligation); | |||
let result = select.poly_select(&obligation); |
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.
feels like we may end up with with placeholders in the environment/output here, so it might be safer to check for no_bound_vars
. Doesn't matter much, this keeps the current behavior and we're going to rewrite this code anyways
@@ -123,8 +124,8 @@ pub struct SelectionContext<'cx, 'tcx> { | |||
} | |||
|
|||
// A stack that walks back up the stack frame. | |||
struct TraitObligationStack<'prev, 'tcx> { | |||
obligation: &'prev TraitObligation<'tcx>, | |||
struct PolyTraitObligationStack<'prev, '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.
i think we should keep this as TraitObligationStack
, the Poly
doesn't add any meaningful info imo and makes the code harder to read imo
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.
No this is just because I was stupid and used ctrl+f to replace names, and I didn't see this was edited too 🤦
@@ -2946,21 +2962,23 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> { | |||
} | |||
|
|||
#[derive(Copy, Clone)] | |||
struct TraitObligationStackList<'o, 'tcx> { | |||
struct PolyTraitObligationStackList<'o, '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.
struct PolyTraitObligationStackList<'o, 'tcx> { | |
struct TraitObligationStackList<'o, 'tcx> { |
also, please run perf after rebasing, I think that not having a |
d9d1cf2
to
3f8919c
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 3f8919c with merge 5d2ae64c182026baa066c3144d019b08883a6cbf... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (5d2ae64c182026baa066c3144d019b08883a6cbf): comparison URL. Overall result: ❌ regressions - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 657.995s -> 658.303s (0.05%) |
I'm pretty certain that's noise, given it affects |
@bors r=lcnr |
☀️ Test successful - checks-actions |
Finished benchmarking commit (1a449dc): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 658.878s -> 657.277s (-0.24%) |
most usages of
SelectionContext::select
don't need to use a binder, but wrap them in a dummy because of the signature. Let's split this out intoSelectionContext::{select,poly_select}
and limit the usages of the latter.Right now, we only have 3 places where we're calling
poly_select
-- fulfillment, internally within the old solver, and the auto-trait finder.r? @lcnr