Rust-GCC / Rust-GCC/gccrs

ICE in push_new_name_rib, at rust/resolve/rust-name-resolver.cc:302

Open
#3,598 1 comment 0 reactions 1 assignee View on GitHub

@powerboat9 is already working on this.

Since Jul 11, 2025.

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

Description

auto-reduced (treereduce-rust):

#![len]

struct FakeArray<T>(T);

impl<T> FakeArray<u32, { 32 }> {}

original:



#![len]

struct FakeArray<T, const N: usize>(T);

impl<T, const N: usize> FakeArray<u32, { 32 }> {
    fn len(&self) -> u32 {
        N
    }
}

fn main() { 32 }

Version information:

34b0a681598d52de442a0a21c3a7df20bf1485bc

Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/34b0a681598d52de442a0a21c3a7df20bf1485bc/gcc/rust/resolve/rust-name-resolver.cc#L296-L308

Command:
crab1 -Warray-bounds -mtune=generic -march=x86-64 -O0 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -frust-incomplete-and-experimental-compiler-do-not-use

Program output

crab1: internal compiler error: in push_new_name_rib, at rust/resolve/rust-name-resolver.cc:302
0x867e91 Rust::Resolver::Resolver::push_new_name_rib(Rust::Resolver::Rib*)
	../../gcc/rust/resolve/rust-name-resolver.cc:302
0xe6be27 Rust::Resolver::ResolveExpr::visit(Rust::AST::BlockExpr&)
	../../gcc/rust/resolve/rust-ast-resolve-expr.cc:269
0xe6e524 Rust::Resolver::ResolveExpr::go(Rust::AST::Expr&, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&, bool)
	../../gcc/rust/resolve/rust-ast-resolve-expr.cc:36
0xe756d6 Rust::Resolver::ResolveGenericArgs::resolve_disambiguated_generic(Rust::AST::GenericArg&)
	../../gcc/rust/resolve/rust-ast-resolve-type.cc:744
0xe756d6 Rust::Resolver::ResolveGenericArgs::go(Rust::AST::GenericArgs&, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&)
	../../gcc/rust/resolve/rust-ast-resolve-type.cc:773
0xe757ba Rust::Resolver::ResolveGenericArgs::go(Rust::AST::GenericArgs&)
	../../gcc/rust/resolve/rust-ast-resolve-type.cc:758
0xe76c4b Rust::Resolver::ResolveTypeToCanonicalPath::visit(Rust::AST::TypePath&)
	../../gcc/rust/resolve/rust-ast-resolve-type.cc:520
0xe70bdf Rust::Resolver::ResolveTypeToCanonicalPath::go(Rust::AST::Type&, Rust::Resolver::CanonicalPath&)
	../../gcc/rust/resolve/rust-ast-resolve-type.cc:491
0xe5b459 Rust::Resolver::ResolveItem::visit(Rust::AST::InherentImpl&)
	../../gcc/rust/resolve/rust-ast-resolve-item.cc:584
0xe5ab7c Rust::Resolver::ResolveItem::go(Rust::AST::Item&, Rust::Resolver::CanonicalPath const&, Rust::Resolver::CanonicalPath const&)
	../../gcc/rust/resolve/rust-ast-resolve-item.cc:174
0xe4966d Rust::Resolver::NameResolution::go(Rust::AST::Crate&)
	../../gcc/rust/resolve/rust-ast-resolve.cc:108
0xc5c2d5 Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:650
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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.