Higher-ranked fn
pointers can be cast but no longer coerce
#95132
Labels
C-bug
Category: This is a bug.
P-medium
Medium priority
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
Code
I tried this code:
I expected to see this happen: Successful compilation
Instead, this happened: Compiler error:
Version it worked on
It most recently worked on: Rust 1.35.
It works on every version before that which I spot checked (but I did not spot check all of them).
Versions before 1.18.0 cannot coerce a closure to a function pointer, but this variation:
Works all the way back to Rust 1.0.0.
Versions with regression
Rust 1.36.0 and all those which I spot-checked after this version.
The error changes in Rust 1.56.0 due to one of the #57374 fixes; I didn't track down which.
Current playground, any version.
Workaround
Casting still works:
But RFC 401 says this should not be necessary.
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged
The text was updated successfully, but these errors were encountered: