Open
Description
Code
#![feature(generic_const_exprs)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
struct FlatTree;
#[derive(Copy, Clone)]
struct TreeLeaf;
#[derive(Copy, Clone)]
struct TreeNode<V, W>(V, W);
const fn const_concat<const A: usize, const B: usize>(_: [FlatTree; A], _: [FlatTree; B]) -> [FlatTree; A + B] {
[FlatTree; A + B]
}
struct Builder<const N: usize, I> {
ops: [FlatTree; N],
builder: I,
}
fn create_node<const N: usize, const M: usize, A, B>(a: Builder<N, A>, b: Builder<M, B>) -> Builder<{ N + M + 1 }, TreeNode<A, B>> {
Builder {
ops: const_concat(const_concat::<N, M>(a.ops, b.ops), [FlatTree]),
builder: TreeNode(a.builder, b.builder),
}
}
const LEAF: Builder<1, TreeLeaf> = Builder {
ops: [FlatTree],
builder: TreeLeaf,
};
static INTERNAL_SIMPLE_BOOLEAN_TEMPLATES: &[fn()] = &[{
fn eval() {
create_node(LEAF, create_node(LEAF, LEAF));
}
eval
}];
Meta
rustc --version --verbose
:
rustc 1.76.0-nightly (9fad68599 2023-12-03)
binary: rustc
commit-hash: 9fad6859925b34f9a0b1af592a7839ccb1e71f60
commit-date: 2023-12-03
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.5
Error output
Compiling minimal-rust v0.1.0 (/home/../workspace/repro/minimal-rust)
[..] (warnings removed)
error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:1043:21: `fn_abi_of_instance(const_concat::<{const expr}, 1>, [])` failed: Layout(Unknown([FlatTree; UnevaluatedConst { def: DefId(0:8 ~ minimal_rust[599e]::const_concat::{constant#2}), args: [(Add: 1_usize, 3_usize): usize, 1_usize] }: usize]))
--> minimal-rust/src/lib.rs:11:1
|
11 | const fn const_concat<const A: usize, const B: usize>(_: [FlatTree; A], _: [FlatTree; B]) -> [FlatTree; A + B] {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
thread 'rustc' panicked at /rustc/9fad6859925b34f9a0b1af592a7839ccb1e71f60/compiler/rustc_errors/src/lib.rs:995:33:
Box<dyn Any>
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: please attach the file at `/home/../workspace/repro/rustc-ice-2023-12-04T12_27_11-290639.txt` to your bug report
note: compiler flags: --crate-type lib -C opt-level=2 -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
warning: `minimal-rust` (lib) generated 6 warnings
error: could not compile `minimal-rust` (lib); 6 warnings emitted
Backtrace
thread 'rustc' panicked at /rustc/9fad6859925b34f9a0b1af592a7839ccb1e71f60/compiler/rustc_errors/src/lib.rs:995:33:
Box<dyn Any>
stack backtrace:
0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
1: <rustc_errors::HandlerInner>::span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
2: <rustc_errors::Handler>::span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
6: rustc_middle::util::bug::span_bug_fmt::<rustc_span::span_encoding::Span>
7: <rustc_codegen_llvm::context::CodegenCx as rustc_middle::ty::layout::FnAbiOfHelpers>::handle_fn_abi_err
8: <rustc_codegen_llvm::context::CodegenCx as rustc_middle::ty::layout::FnAbiOf>::fn_abi_of_instance::{closure#0}
9: <rustc_codegen_llvm::context::CodegenCx as rustc_codegen_ssa::traits::declare::PreDefineMethods>::predefine_fn
10: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
11: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit
12: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
13: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
14: rustc_interface::passes::start_codegen
15: <rustc_interface::queries::Queries>::codegen_and_build_linker
16: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Relevant to the compiler team, which will review and decide on the PR/issue.