ICE: in map_usage, at rust/resolve/rust-name-resolution-context.cc:258
Open
Nobody has claimed this yet.
bug
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 230
- Avg merge
- 19h 55m
- Merged PRs (30d)
- 67
Description
Code
fn foo<const N: usize>(bar: impl Iterator<Item = &str>, n: usize) -> impl Iterator<Item = u8> {
n + 42
}
Version information:
bc2a3e6
Program output:
GNU Rust (GCC) version 16.0.0 20250604 (experimental) (x86_64-pc-linux-gnu)
compiled by GNU C version 11.4.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
options passed: -frust-debug -frust-dump-ast-pretty -mtune=generic -march=x86-64 -O0 -frust-incomplete-and-experimental-compiler-do-not-use
../test.rs:1:34: error: could not resolve type path ‘Iterator’ [E0412]
1 | fn foo<const N: usize>(bar: impl Iterator<Item = &str>, n: usize) -> impl Iterator<Item = u8> {
| ^~~~~~~~
crab1: note: popping link
crab1: note: new cursor: k: N, v: (S)[] (NS)[5] (G)[]
crab1: note: popping link
crab1: note: new cursor: k: Impl_0, v: (S)[] (NS)[88] (G)[]
crab1: note: popping link
../test.rs:1:75: error: could not resolve type path ‘Iterator’ [E0412]
1 | fn foo<const N: usize>(bar: impl Iterator<Item = &str>, n: usize) -> impl Iterator<Item = u8> {
| ^~~~~~~~
crab1: internal compiler error: in map_usage, at rust/resolve/rust-name-resolution-context.cc:258
0x29abe86 internal_error(char const*, ...)
../../gccrs/gcc/diagnostic-global-context.cc:517
0xb48036 fancy_abort(char const*, int, char const*)
../../gccrs/gcc/diagnostic.cc:1803
0x913de5 Rust::Resolver2_0::NameResolutionContext::map_usage(Rust::Resolver2_0::Usage, Rust::Resolver2_0::Definition)
../../gccrs/gcc/rust/resolve/rust-name-resolution-context.cc:258
0xe4d308 Rust::Resolver2_0::Late::visit(Rust::AST::TypePath&)
../../gccrs/gcc/rust/resolve/rust-late-name-resolver-2.0.cc:572
0xe4a602 Rust::Resolver2_0::Late::visit(Rust::AST::GenericArgs&)
../../gccrs/gcc/rust/resolve/rust-late-name-resolver-2.0.cc:700
0xc68abf void Rust::AST::DefaultASTVisitor::visit<Rust::AST::TypePathSegment>(std::unique_ptr<Rust::AST::TypePathSegment, std::default_delete<Rust::AST::TypePathSegment> >&)
../../gccrs/gcc/rust/ast/rust-ast-visitor.h:416
0xc68abf Rust::AST::DefaultASTVisitor::visit(Rust::AST::TypePath&)
../../gccrs/gcc/rust/ast/rust-ast-visitor.cc:159
0xe4d078 Rust::Resolver2_0::Late::visit(Rust::AST::TypePath&)
../../gccrs/gcc/rust/resolve/rust-late-name-resolver-2.0.cc:532
0xc691ff void Rust::AST::DefaultASTVisitor::visit<Rust::AST::TypeParamBound>(std::unique_ptr<Rust::AST::TypeParamBound, std::default_delete<Rust::AST::TypeParamBound> >&)
../../gccrs/gcc/rust/ast/rust-ast-visitor.h:416
0xc691ff Rust::AST::DefaultASTVisitor::visit(Rust::AST::TypeBoundWhereClauseItem&)
../../gccrs/gcc/rust/ast/rust-ast-visitor.cc:781
0xc6c59f void Rust::AST::DefaultASTVisitor::visit<Rust::AST::WhereClauseItem>(std::unique_ptr<Rust::AST::WhereClauseItem, std::default_delete<Rust::AST::WhereClauseItem> >&)
../../gccrs/gcc/rust/ast/rust-ast-visitor.h:416
0xc6c59f Rust::AST::DefaultASTVisitor::visit(Rust::AST::WhereClause&)
../../gccrs/gcc/rust/ast/rust-ast-visitor.cc:799
0xc6c59f Rust::AST::DefaultASTVisitor::visit(Rust::AST::Function&)
../../gccrs/gcc/rust/ast/rust-ast-visitor.cc:886
0xe2bda1 operator()
../../gccrs/gcc/rust/resolve/rust-default-resolver.cc:72
0xe2bda1 scope_inner<Rust::Resolver2_0::CanonicalPathCtx::scope<Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)::<lambda()> >(Rust::NodeId, std::string, Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)::<lambda()>&&)::<lambda()>, Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)::<lambda()> >
../../gccrs/gcc/rust/resolve/rust-name-resolution-context.h:470
0xe2bda1 scope<Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)::<lambda()> >
../../gccrs/gcc/rust/resolve/rust-name-resolution-context.h:413
0xe2bda1 scope<Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)::<lambda()> >
../../gccrs/gcc/rust/resolve/rust-name-resolution-context.h:406
0xe2bda1 operator()
../../gccrs/gcc/rust/resolve/rust-default-resolver.cc:75
0xe2bda1 __invoke_impl<void, Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)::<lambda()>&>
/usr/include/c++/11/bits/invoke.h:61
0xe2bda1 __invoke_r<void, Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)::<lambda()>&>
/usr/include/c++/11/bits/invoke.h:111
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
Start by reproducing the ICE with the Rust snippet in test.rs using the reported gccrs revision. Read rust/resolve/rust-name-resolution-context.cc:258 and the related visits in rust/resolve/rust-late-name-resolver-2.0.cc. Done means this input no longer triggers an internal compiler error and produces appropriate diagnostics.
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
- 35/100