-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Function pointers break in const code after ~const
bounds are added
#109543
Comments
Nominating for libs-api - though may want to hold discussion until there's a const folks opinion on how hard a fix will be in the compiler. The code is pretty esoteric but still seems bad to break. @cuviper did this appear in real world code? Or just happened to stumble across it? |
It appeared as a new error in |
CC @rust-lang/wg-const-eval |
I'm going to take a look on resolving this in the compiler. |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-high |
…=oli-obk Move const trait bounds checks to MIR constck Fixes rust-lang#109543. When checking paths in HIR typeck, we don't want to check for const predicates since all we want might just be a function pointer. Therefore we move this to MIR constck and check that bounds are met during MIR constck. r? `@oli-obk`
Revert 102245 reverts rust-lang#102245, but only on beta, as that caused rust-lang#109543 which has since been fixed on nightly. This needed an additional partial revert of rust-lang@5b08c9f for changes that happened due to later cleanups. I also added a test from the issue to make sure this actually fixes it 😆 r? `@wesleywiser` `@pnkfelix`
Code
I first noticed this in #109122 (review), but there are also existing regressions from other
~const
additions. For example:I expected to see this happen: compiles fine.
Instead, this happened: errors that
~const FnOnce
is not implemented for theI32Cmp
function pointer.Version it worked on
For that particular example, it most recently worked on: 1.65.0
Version with regression
After #102245 reached stable,
rustc --version --verbose
:... but I don't mean to pick on that particular PR -- I think there's a more general problem with
~const
here.@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged
The text was updated successfully, but these errors were encountered: