ICE `tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in type_hasher, at rust/backend/rust-compile-context.cc:`
Maintainers usually reply within 3 days
@philberty is already working on this.
Since Aug 16, 2026.
Assessment
This issue has not been assessed yet.
Description
auto-reduced (treereduce-rust):
//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use -frust-crate-attr=no_core
//
const A_I8_T: [u32; (&[] as &[_]) as usize] = [0; () + 1];
original:
// Evaluation of constants in array-elem count goes through different
// compiler control-flow paths.
//
// This test is checking the count in an array type.
//@ dont-require-annotations: NOTE
#![allow(unused_imports)]
const A_I8_T
: [u32; (&[] as &[_]) as usize]
//~^ ERROR mismatched types
//~| NOTE expected `i8`, found `u8`
//~| ERROR cannot add `u8` to `i8`
= [0; (i8::MAX as usize) + 1];
const A_CHAR_USIZE
: [u32; 5u8 as char as usize]
= [0; 5];
const A_BAD_CHAR_USIZE
: [u32; 5i8 as char as usize]
//~^ ERROR only `u8` can be cast as `char`, not `i8`
= [0; 5];
fn main() {}
Version information:
c539964b8cc842e871d77b45150df6a5882335fb
Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use -frust-crate-attr=no_core -frust-crate-attr=feature(no_core)
Program output
/tmp/icemaker_global_tempdir.flI2N1Vn1tfa/rustc_testrunner_tmpdir_reporting.7Yfx3fzXzwos/mvce.rs:3:21: error: casting ‘& [T?]’ as ‘usize’ is invalid [E0606]
3 | const A_I8_T: [u32; (&[] as &[_]) as usize] = [0; () + 1];
| ^ ~~~~~
crab1: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in type_hasher, at rust/backend/rust-compile-context.cc:56
0x32edd17 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:787
0xacb7e4 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*)
../../gcc/tree.cc:9266
0x939c50 tree_class_check(tree_node*, tree_code_class, char const*, int, char const*)
../../gcc/tree.h:3965
0x939c50 Rust::Compile::Context::type_hasher(tree_node*)
../../gcc/rust/backend/rust-compile-context.cc:56
0x11e502d Rust::Compile::Context::insert_main_variant(tree_node*)
../../gcc/rust/backend/rust-compile-context.h:92
0x11e502d Rust::Compile::TyTyResolveCompile::create_slice_type_record(Rust::TyTy::SliceType const&)
../../gcc/rust/backend/rust-compile-type.cc:925
0x11e7a74 Rust::Compile::TyTyResolveCompile::visit(Rust::TyTy::ReferenceType const&)
../../gcc/rust/backend/rust-compile-type.cc:713
0x11e3435 Rust::Compile::TyTyResolveCompile::compile(Rust::Compile::Context*, Rust::TyTy::BaseType const*, bool)
../../gcc/rust/backend/rust-compile-type.cc:45
0x11d6fd4 ???
../../gcc/rust/backend/rust-compile-expr.h:51
0x11cfcba ???
../../gcc/rust/backend/rust-compile-expr.h:60
0x11d700f ???
../../gcc/rust/backend/rust-compile-expr.h:51
0x11d3a26 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
../../gcc/rust/backend/rust-compile-expr.cc:166
0x120a9e0 Rust::Compile::HIRCompileBase::compile_constant_item(unsigned int, Rust::TyTy::BaseType*, Rust::TyTy::BaseType*, Rust::Resolver::CanonicalPath const&, Rust::HIR::Expr&, unsigned long, unsigned long)
../../gcc/rust/backend/rust-compile-base.cc:996
0x120be24 Rust::Compile::HIRCompileBase::compile_constant_expr(Rust::Compile::Context*, unsigned int, Rust::TyTy::BaseType*, Rust::TyTy::BaseType*, Rust::Resolver::CanonicalPath const&, Rust::HIR::Expr&, unsigned long, unsigned long)
../../gcc/rust/backend/rust-compile-base.cc:642
0x120be24 Rust::Compile::HIRCompileBase::query_compile_const_expr(Rust::Compile::Context*, Rust::TyTy::BaseType*, Rust::HIR::Expr&)
../../gcc/rust/backend/rust-compile-base.cc:657
0x10c1174 Rust::Resolver::TypeCheckType::visit(Rust::HIR::ArrayType&)
../../gcc/rust/typecheck/rust-hir-type-check-type.cc:720
0x10c00c7 Rust::Resolver::TypeCheckType::Resolve(Rust::HIR::Type&)
../../gcc/rust/typecheck/rust-hir-type-check-type.cc:73
0x10c17d7 Rust::Resolver::TypeCheckType::Resolve(Rust::HIR::Type&)
../../gcc/rust/typecheck/rust-hir-type-check-type.cc:72
0x10a9704 Rust::Resolver::TypeCheckItem::visit(Rust::HIR::ConstantItem&)
../../gcc/rust/typecheck/rust-hir-type-check-item.cc:565
0x10aad5c Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
../../gcc/rust/typecheck/rust-hir-type-check-item.cc:60
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 /tmp/icemaker_global_tempdir.flI2N1Vn1tfa/rustc_testrunner_tmpdir_reporting.7Yfx3fzXzwos/mvce.rs -o/tmp/icemaker_global_tempdir.flI2N1Vn1tfa/rustc_testrunner_tmpdir_reporting.7Yfx3fzXzwos/binaryname -frust-incomplete-and-experimental-compiler-do-not-use -frust-crate-attr=no_core -frust-crate-attr=feature(no_core)
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
- Dominant language
- C++
- Stars
- 3k
- Forks
- 238
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 31
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Rust-GCC/gccrs
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 3 days
-
Allow pattern matching of floating point literalsPossibly taken @Vivekkumar0995 claimed this 7 days ago. Opencleanup good-first-pr typechecking
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Rust-GCC/gccrs#5047 · 3 comments · 1 assignee ·
Maintainers usually reply within 3 days
-
ICE in variance analysis on core, projection field keeps the impl's type paramPossibly taken @u7k4rs6 claimed this 1 day ago. Opentypechecking
Rust-GCC/gccrs#5074 · 1 assignee ·
Maintainers usually reply within 3 days
-
subset-error typechecking
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Maintainers usually reply within 3 days
-
Difficulty 3/5 1-2 days Newbie friendliness 46/100
Rust-GCC/gccrs#5060 · 2 comments ·
Maintainers usually reply within 3 days
Similar issues
-
area/ysql kind/bug priority/medium status/awaiting-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
yugabyte/yugabyte-db#37523 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Cockatrice/Cockatrice#7896 ·
Maintainers usually reply within 1 day
-
mlir
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
llvm/llvm-project#241070 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
ros-navigation/navigation2#6771 ·
Maintainers usually reply within 1 day
-
backlog documentation
Difficulty 1/5 Under an hour Newbie friendliness 96/100
EchoTools/nevr-runtime#2354 ·
Maintainers usually reply within 1 day