-
Notifications
You must be signed in to change notification settings - Fork 13k
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
stability break in rust 1.54: generic Self
types are currently not permitted in anonymous constants
#88888
Comments
I suspect this might actually be down to #83167, but not sure. |
This example, which does not use const generics, also compiled in 1.53 and fails in newer versions: use std::arch::x86_64::*;
trait GenU8 {
const X: i32;
}
unsafe fn f<X: GenU8>(v: __m128i) -> __m128i {
_mm_shufflelo_epi16(v, X::X)
} |
That example is similarly using const generics; just implicitly. From 1.54 onwards, the immediate parameter in _mm_shufflelo_epi16 is defined using const generics, with desugaring from the function form implicitly done by the compiler. |
My point is that it breaks code that compiled much before (explicit) const generics were introduced. |
Bisection on the second example searched nightlies: from nightly-2020-04-01 to nightly-2021-09-11 bisected with cargo-bisect-rustc v0.6.0Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --start 2020-04-01 --access github --regress error |
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group. @rustbot label -I-prioritize +P-high |
Visited during P-high review @rust-lang/project-const-generics , can you all spend some time trying to brainstorm best way to resolve this? |
This breakage was known and cratered. The fix is to get generic const expressions stabilized. Closing as duplicate of #76560 |
I tried this code:
I expected to see this happen:
This code was accepted in Rust 1.53, so newer versions should also accept it.
Instead, this happened:
Meta
Tested using rustc 1.53 and 1.54 (and newer) from Compiler Explorer.
The text was updated successfully, but these errors were encountered: