-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
compiler crash caused by using feature(generic_const_exprs) #114212
Comments
It is a well-known feature, unfortunately, that code may typecheck in isolation but fail to compile when actually instantiated. The type system catches most of these problems on its own (barring bugs in its implementation...), but it is particularly a problem for incomplete features. |
I am adding the |
Good instinct! #![allow(incomplete_features)]
#![feature(generic_const_exprs)]
const SOME_CONST: usize = 1;
struct UwU<
// have a const generic with a default that's from another const item
// (associated consts work, a const declared in a block here, inline_const, etc)
const N: usize = SOME_CONST,
// use the previous const in a type generic
A = [(); N],
> {
// here to suppress "unused generic" error if the code stops ICEing
_x: core::marker::PhantomData<A>,
} @rustbot label -E-needs-mcve A small note (though, with background, not surprising): this code also ICEs on stable, after emitting the " |
#114317 found another reproducer: struct A<const B: str = 1, C>; |
@rustbot claim |
Another reproducer: const MY_CONST: usize = 1;
struct S<const B: usize = MY_CONST, C>; |
Duplicate of #106994 Perhaps we can close this one in favour of that. |
sure. |
This a minimized code that causes the compiler to crash. While the example itself doesn't need the
generic_const_exprs
feature, the original library uses it and even compiles, but a binary that depends on the library and itself does not includegeneric_const_exprs
feature, causes the exactly same internal compiler errorCode
Meta
Error output
Backtrace
The text was updated successfully, but these errors were encountered: