-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Fix PartialEq
args when #[const_trait]
is enabled
#118379
Fix PartialEq
args when #[const_trait]
is enabled
#118379
Conversation
Some changes might have occurred in exhaustiveness checking cc @Nadrieril |
|
||
let mut args: Vec<ty::GenericArg<'tcx>> = vec![ty.into(), ty.into()]; | ||
// If `PartialEq` is `#[const_trait]`, then add a const effect param | ||
if self.tcx.generics_of(eq_def_id).host_effect_index.is_some() { |
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.
Maybe I should make a helper fn that appends a const param and interns the generic args list, something like:
fn with_opt_const_effect_param(tcx: TyCtxt<'tcx>, caller_def_id: LocalDefId, callee_def_id: DefId, args: impl IntoIterator<Item = impl Into<GenericArg>>) -> &'tcx GenericArgs<'tcx> {}
That checks if the callee_def_id has a const effect param, and if so, constructs it based off of the caller_def_id, appends it, then interns the args...
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.
Yes, that would be very nice for more lang item migrations in the future.
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.
} | ||
None => tcx.consts.true_, | ||
}; | ||
let effect = tcx.expected_const_effect_param_for_body(self.body_id); |
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.
we probably should have an assert here that self.body_id == tcx.hir().enclosing_body_owner(call_expr_hir)
☔ The latest upstream changes (presumably #118282) made this pull request unmergeable. Please resolve the merge conflicts. |
fd4ab16
to
d3404d2
Compare
Thanks :) @bors r+ |
…tialeq, r=fee1-dead Fix `PartialEq` args when `#[const_trait]` is enabled This is based off of your PR that enforces effects on all methods, so just see the last commits. r? fee1-dead
💔 Test failed - checks-actions |
spurious |
…tialeq, r=fee1-dead Fix `PartialEq` args when `#[const_trait]` is enabled This is based off of your PR that enforces effects on all methods, so just see the last commits. r? fee1-dead
💔 Test failed - checks-actions |
@bors retry |
☀️ Test successful - checks-actions |
Finished benchmarking commit (e55544c): comparison URL. Overall result: ✅ improvements - 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: 673.65s -> 673.827s (0.03%) |
This is based off of your PR that enforces effects on all methods, so just see the last commits.
r? fee1-dead