-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
ICE: Normalization of 'ty::ConstKind::Expr' is unimplemented
#132960
Labels
A-const-generics
Area: const generics (parameters and arguments)
C-bug
Category: This is a bug.
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
S-bug-has-test
Status: This bug is tracked inside the repo by a `known-bug` test.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
matthiaskrgr
added
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Nov 12, 2024
rustbot
added
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Nov 12, 2024
bisects to #132927 as well |
matthiaskrgr
changed the title
ICE: `Unevaluated 'ty::Const' in MIR body'
ICE: Nov 12, 2024
Unevaluated 'ty::Const' in MIR body
saethlin
removed
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Nov 12, 2024
This is another case of |
BoxyUwU
added
A-const-generics
Area: const generics (parameters and arguments)
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
labels
Nov 13, 2024
matthiaskrgr
changed the title
ICE:
ICE: Nov 14, 2024
Unevaluated 'ty::Const' in MIR body
Normalization of 'ty::ConstKind::Expr' is unimplemented
auto-reduced (treereduce-rust): #![feature(adt_const_params, const_ptr_read, generic_const_exprs)]
const fn concat_strs<const A: &'static str, const B: &'static str>() -> &'static str
where
[(); A.len()]:,
[(); B.len()]:,
[(); A.len() + B.len()]:,
{
#[repr(C)]
#[repr(C)]
const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}
struct Inner<const A: &'static str, const B: &'static str>;
impl<const A: &'static str, const B: &'static str> Inner<A, B>
where
[(); A.len()]:,
[(); B.len()]:,
[(); A.len() + B.len()]:,
{
const ABSTR: &'static str = unsafe {
std::str::from_utf8_unchecked(&concat_arr(
A.as_ptr().cast().read(),
B.as_ptr().cast().read(),
))
};
}
Inner::<A, B>::ABSTR
}
const FOO: &str = "foo";
const BAR: &str = "bar";
const FOOBAR: &str = concat_strs::<FOO, BAR>(); original code
original: #![feature(unsized_const_params)]
#![feature(adt_const_params, const_ptr_read, generic_const_exprs)]
use std::mem::ManuallyDrop;
const fn concat_strs<const A: &'static str, const B: &'static str>() -> &'static str
where
[(); A.len()]:,
[(); B.len()]:,
[(); A.len() + B.len()]:,
{
#[repr(C)]
struct ConcatJoin<const N: usize, const M: usize> {
left: [u8; N],
right: [u8; M],
}
#[repr(C)]
union ConcatJoiner<const N: usize, const M: usize>
where
[(); N + M]:,
{
whole: ManuallyDrop<[u8; N + M]>,
split: ManuallyDrop<ConcatJoin<N, M>>,
}
const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {
unsafe {
let joiner = ConcatJoiner {
split: ManuallyDrop::new(ConcatJoin { left: a, right: b }),
};
let join = joiner.whole;
ManuallyDrop::into_inner(join)
}
}
struct Inner<const A: &'static str, const B: &'static str>;
impl<const A: &'static str, const B: &'static str> Inner<A, B>
where
[(); A.len()]:,
[(); B.len()]:,
[(); A.len() + B.len()]:,
{
const ABSTR: &'static str = unsafe {
std::str::from_utf8_unchecked(&concat_arr(
A.as_ptr().cast().read(),
B.as_ptr().cast().read(),
))
};
}
Inner::<A, B>::ABSTR
}
const FOO: &str = "foo";
const BAR: &str = "bar";
const FOOBAR: &str = concat_strs::<FOO, BAR>(); Version information
Command: Program output
|
matthiaskrgr
added
the
S-bug-has-test
Status: This bug is tracked inside the repo by a `known-bug` test.
label
Dec 16, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-const-generics
Area: const generics (parameters and arguments)
C-bug
Category: This is a bug.
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
S-bug-has-test
Status: This bug is tracked inside the repo by a `known-bug` test.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
auto-reduced (treereduce-rust):
original code
original:
Version information
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(unsized_const_params) --crate-type=lib
Program output
@rustbot label +F-adt_const_params +F-const_ptr_read +F-generic_const_exprs +F-unsized_const_params
The text was updated successfully, but these errors were encountered: