ICE tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in get_qualified_type, at tree.cc
Open
Nobody has claimed this yet.
bug
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 231
- Avg merge
- 19h 55m
- Merged PRs (30d)
- 67
Description
snippet:
//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use
#![feature(no_core)]
#![no_core]
struct X<const FN: fn(_, &_) = {}>;
Version information:
696cb485cfa9969c952d6765889d82ed548ca15c
Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use
Program output
/tmp/icemaker_global_tempdir.mvX4OLoQFu8L/rustc_testrunner_tmpdir_reporting.Fi1BrmDpwoeF/mvce.rs:3:10: error: mismatched types, expected ‘abi:rust fnptr (T? ,& T? ,) -> ()’ but got ‘()’ [E0308]
3 | struct X<const FN: fn(_, &_) = {}>;
| ^~~~~ ~~ ~
crab1: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in get_qualified_type, at tree.cc:5810
0x32c0107 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:787
0xac713e tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*)
../../gcc/tree.cc:9269
0xaca189 tree_class_check(tree_node*, tree_code_class, char const*, int, char const*)
../../gcc/tree.h:3965
0xaca189 get_qualified_type(tree_node*, int)
../../gcc/tree.cc:5810
0x1f0528f build_qualified_type(tree_node*, int)
../../gcc/tree.cc:5845
0x11ebaa9 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:912
0x11ed0b4 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:641
0x11ed0b4 Rust::Compile::HIRCompileBase::query_compile_const_expr(Rust::Compile::Context*, Rust::TyTy::BaseType*, Rust::HIR::Expr&)
../../gcc/rust/backend/rust-compile-base.cc:656
0x116d39d Rust::Resolver::TypeCheckBase::resolve_generic_params(Rust::HIR::Item::ItemKind, unsigned long, std::vector<std::unique_ptr<Rust::HIR::GenericParam, std::default_delete<Rust::HIR::GenericParam> >, std::allocator<std::unique_ptr<Rust::HIR::GenericParam, std::default_delete<Rust::HIR::GenericParam> > > > const&, std::vector<Rust::TyTy::SubstitutionParamMapping, std::allocator<Rust::TyTy::SubstitutionParamMapping> >&, bool, Rust::ABI)
../../gcc/rust/typecheck/rust-hir-type-check-base.cc:625
0x10a6080 Rust::Resolver::TypeCheckItem::visit(Rust::HIR::StructStruct&)
../../gcc/rust/typecheck/rust-hir-type-check-item.cc:324
0x109749c Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
../../gcc/rust/typecheck/rust-hir-type-check-item.cc:60
0x1027e1b Rust::Resolver::TypeResolution::Resolve(Rust::HIR::Crate&)
../../gcc/rust/typecheck/rust-hir-type-check.cc:72
0xec74c9 Rust::Session::compile_crate(char const*)
../../gcc/rust/rust-session-manager.cc:804
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 /tmp/icemaker_global_tempdir.mvX4OLoQFu8L/rustc_testrunner_tmpdir_reporting.Fi1BrmDpwoeF/mvce.rs -o/tmp/icemaker_global_tempdir.mvX4OLoQFu8L/rustc_testrunner_tmpdir_reporting.Fi1BrmDpwoeF/binaryname -frust-incomplete-and-experimental-compiler-do-not-use
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.
Contributor 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.
Research direction
Reproduce the ICE with the provided /tmp/gccrs/a.rs snippet and compiler command, then start at compile_constant_item in gcc/rust/backend/rust-compile-base.cc:912 and follow the callers shown in the trace. Done means this input produces the expected type-mismatch diagnostic without an internal compiler error or tree-check failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100