-
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
Implement PartialEq
for all function pointers via a shim
#108074
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @compiler-errors (or someone else) soon. Please see the contribution instructions for more information. |
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
||
let x: fn(&'static ()) = foo; | ||
let y: for<'a> fn(&'a ()) = foo; | ||
x == y; |
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.
So it works if the RHS is higher-ranked, but not if the LHS is higher-ranked? That is odd...
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.
that seems definitely fixable, but I think it's a preexisting issue of binary ops.
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 assume this is related to this remark?
== has too much magic to work with this.
I don't think I understand what the magic is, I thought a == b
was just PartialEq::eq(&a, &b)
...
@@ -837,15 +837,9 @@ fn trait_method<'tcx>( | |||
method_name: Symbol, | |||
substs: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>, | |||
) -> ConstantKind<'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.
why does this not use lang_items
?
The job Click to see the possible cause of the failure (guessed by this bot)
|
@rustbot author |
closing in favor of #108080 |
This allows comparing higher kinded function pointers, at least directly via
PartialEq
.==
has too much magic to work with this.We can implement this in libstd without needing a shim once #99531 lands
this unblocks #105750
r? types