Rust-GCC / Rust-GCC/gccrs

ICE `in get_predicate_from_bound, at rust/typecheck/rust-tyty-bounds.cc:297`

Open
#3,957 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
trait Fn {}

impl Fn for () {
    const ASSOC: &dyn Fn(_) = 1i32;
}

fn Fn() {}

original:

trait Fn {
    const ASSOC: i32;
}

impl Fn for () {
    const ASSOC: &dyn Fn(_) = 1i32;
    //~^ ERROR the placeholder `_` is not allowed within types on item signatures for associated constants
}

fn Fn() {}

Version information:

5dc8c4d20d62462ebce137c6e5146235ab9e9e2e

Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/5dc8c4d20d62462ebce137c6e5146235ab9e9e2e/gcc/rust/typecheck/rust-tyty-bounds.cc#L291-L303

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 get_predicate_from_bound, at rust/typecheck/rust-tyty-bounds.cc:297
0x2fecaf8 internal_error(char const*, ...)
	../../gcc/diagnostic-global-context.cc:517
0xc0e04d fancy_abort(char const*, int, char const*)
	../../gcc/diagnostic.cc:1803
0x903e71 Rust::Resolver::TypeCheckBase::get_predicate_from_bound(Rust::HIR::TypePath&, tl::optional<std::reference_wrapper<Rust::HIR::Type> >, Rust::BoundPolarity, bool, bool)
	../../gcc/rust/typecheck/rust-tyty-bounds.cc:297
0x108c872 Rust::Resolver::TypeCheckType::visit(Rust::HIR::TraitObjectType&)
	../../gcc/rust/typecheck/rust-hir-type-check-type.cc:674
0x1082477 Rust::Resolver::TypeCheckType::Resolve(Rust::HIR::Type&)
	../../gcc/rust/typecheck/rust-hir-type-check-type.cc:71
0x1082be4 Rust::Resolver::TypeCheckType::Resolve(Rust::HIR::Type&)
	../../gcc/rust/typecheck/rust-hir-type-check-type.cc:67
0x1082be4 Rust::Resolver::TypeCheckType::visit(Rust::HIR::ReferenceType&)
	../../gcc/rust/typecheck/rust-hir-type-check-type.cc:735
0x1082477 Rust::Resolver::TypeCheckType::Resolve(Rust::HIR::Type&)
	../../gcc/rust/typecheck/rust-hir-type-check-type.cc:71
0x10838b7 Rust::Resolver::TypeCheckType::Resolve(Rust::HIR::Type&)
	../../gcc/rust/typecheck/rust-hir-type-check-type.cc:67
0x10afb44 Rust::Resolver::TypeCheckImplItem::visit(Rust::HIR::ConstantItem&)
	../../gcc/rust/typecheck/rust-hir-type-check-implitem.cc:397
0x10b08cc Rust::Resolver::TypeCheckImplItem::Resolve(Rust::HIR::ImplBlock&, Rust::HIR::ImplItem&, Rust::TyTy::BaseType*, std::vector<Rust::TyTy::SubstitutionParamMapping, std::allocator<Rust::TyTy::SubstitutionParamMapping> >)
	../../gcc/rust/typecheck/rust-hir-type-check-implitem.cc:194
0x10b08cc Rust::Resolver::TypeCheckImplItem::Resolve(Rust::HIR::ImplBlock&, Rust::HIR::ImplItem&, Rust::TyTy::BaseType*, std::vector<Rust::TyTy::SubstitutionParamMapping, std::allocator<Rust::TyTy::SubstitutionParamMapping> >)
	../../gcc/rust/typecheck/rust-hir-type-check-implitem.cc:178
0x10786c7 Rust::Resolver::TypeCheckItem::visit(Rust::HIR::ImplBlock&)
	../../gcc/rust/typecheck/rust-hir-type-check-item.cc:534
0x106e185 Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
	../../gcc/rust/typecheck/rust-hir-type-check-item.cc:59
0x100adcb Rust::Resolver::TypeResolution::Resolve(Rust::HIR::Crate&)
	../../gcc/rust/typecheck/rust-hir-type-check.cc:74
0xdb97f8 Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:685
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

Start with the reduced Rust reproducer and run it using -frust-incomplete-and-experimental-compiler-do-not-use. Read gcc/rust/typecheck/rust-tyty-bounds.cc around lines 291-303, then follow the stack into rust-hir-type-check-type.cc. Done means this input no longer causes an internal compiler error and produces the appropriate compiler result.

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
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.