Rust-GCC / Rust-GCC/gccrs

ICE in TypeCheckImplItemWithTrait

Open
#4,612 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
19h 55m
Merged PRs (30d)
67

Description

auto-reduced (treereduce-rust):

//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use
#![feature(no_core)]
#![no_core]
pub trait Archive {}

impl<'a> Archive for <()>::Archived {
    type Item<'a> = ();
}

original:

#![feature(no_core)]
#![no_core]
pub trait Archive {
    type Archived;
}

impl<'a> Archive for <()>::Archived {
    type Item<'a> = ();
}

Version information:

696cb485cfa9969c952d6765889d82ed548ca15c

Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/696cb485cfa9969c952d6765889d82ed548ca15c/gcc/rust/typecheck/rust-hir-type-check-implitem.cc#L454-L466

Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use

Program output

crab1: internal compiler error: in TypeCheckImplItemWithTrait, at rust/typecheck/rust-hir-type-check-implitem.cc:460
0x32c0107 internal_error(char const*, ...)
	../../gcc/diagnostic-global-context.cc:787
0xc7e0b1 fancy_abort(char const*, int, char const*)
	../../gcc/diagnostics/context.cc:1813
0x920c75 Rust::Resolver::TypeCheckImplItemWithTrait::TypeCheckImplItemWithTrait(Rust::HIR::ImplBlock&, Rust::TyTy::BaseType*, Rust::TyTy::TypeBoundPredicate&, std::vector<Rust::TyTy::SubstitutionParamMapping, std::allocator<Rust::TyTy::SubstitutionParamMapping> >)
	../../gcc/rust/typecheck/rust-hir-type-check-implitem.cc:460
0x920c75 Rust::Resolver::TypeCheckImplItemWithTrait::TypeCheckImplItemWithTrait(Rust::HIR::ImplBlock&, Rust::TyTy::BaseType*, Rust::TyTy::TypeBoundPredicate&, std::vector<Rust::TyTy::SubstitutionParamMapping, std::allocator<Rust::TyTy::SubstitutionParamMapping> >)
	../../gcc/rust/typecheck/rust-hir-type-check-implitem.cc:452
0x920c75 Rust::Resolver::TypeCheckImplItemWithTrait::Resolve(Rust::HIR::ImplBlock&, Rust::HIR::ImplItem&, Rust::TyTy::BaseType*, Rust::TyTy::TypeBoundPredicate&, std::vector<Rust::TyTy::SubstitutionParamMapping, std::allocator<Rust::TyTy::SubstitutionParamMapping> >)
	../../gcc/rust/typecheck/rust-hir-type-check-implitem.cc:470
0x109ba26 Rust::Resolver::TypeCheckItem::ResolveImplTraitAssociatedTypes(Rust::Resolver::TypeCheckContext*, Rust::HIR::ImplBlock&, Rust::TyTy::TypeBoundPredicate&, Rust::TyTy::BaseType*, std::vector<Rust::TyTy::SubstitutionParamMapping, std::allocator<Rust::TyTy::SubstitutionParamMapping> >&, std::map<Rust::DefId, Rust::Resolver::AssocTypeEntry, std::less<Rust::DefId>, std::allocator<std::pair<Rust::DefId const, Rust::Resolver::AssocTypeEntry> > >&, std::vector<Rust::Resolver::TraitItemReference const*, std::allocator<Rust::Resolver::TraitItemReference const*> >&)
	../../gcc/rust/typecheck/rust-hir-type-check-item.cc:661
0x10a14f2 Rust::Resolver::TypeCheckItem::resolve_trait_impl_block(Rust::HIR::ImplBlock&)
	../../gcc/rust/typecheck/rust-hir-type-check-item.cc:609
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.TL6bXSvNNdqQ/mvce.rs -o/tmp/icemaker_global_tempdir.mvX4OLoQFu8L/rustc_testrunner_tmpdir_reporting.TL6bXSvNNdqQ/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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the ICE with the reduced Rust program and the listed compiler command. Read gcc/rust/typecheck/rust-hir-type-check-implitem.cc around TypeCheckImplItemWithTrait lines 452-466, then trace the associated-type resolution shown in the backtrace. Done means this input no longer aborts with an internal compiler error and has regression coverage.

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
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.