NR2: ICE: in resolve_path_to_trait, at rust/typecheck/rust-hir-trait-resolve.cc:160 `impl X for Y { type X = .. }`
Nobody has claimed this yet.
- 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 -frust-name-resolution-2.0
pub struct GenericType;
impl Output for GenericType<{ 42 }> {
type Output = ();
}
original:
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
// All of these three items must be in `lib2` to reproduce the error
pub trait TypeFn {
type Output;
}
pub struct GenericType<const B: i8>;
// Removing the braces around `42` resolves the crash
impl Output for GenericType<{ 42 }> {
type Output = ();
}
Version information:
765121736dfe3f5b319bbe9837880deda326394e
Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/765121736dfe3f5b319bbe9837880deda326394e/gcc/rust/typecheck/rust-hir-trait-resolve.cc#L154-L166
Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use -frust-name-resolution-2.0
Program output
crab1: internal compiler error: in resolve_path_to_trait, at rust/typecheck/rust-hir-trait-resolve.cc:160
0x890685 Rust::Resolver::TraitResolver::resolve_path_to_trait(Rust::HIR::TypePath const&, Rust::HIR::Trait**) const
../../gcc/rust/typecheck/rust-hir-trait-resolve.cc:160
0xf74654 Rust::Resolver::TraitResolver::resolve_path(Rust::HIR::TypePath&)
../../gcc/rust/typecheck/rust-hir-trait-resolve.cc:178
0xf74654 Rust::Resolver::TraitResolver::Resolve(Rust::HIR::TypePath&)
../../gcc/rust/typecheck/rust-hir-trait-resolve.cc:93
0xf82738 Rust::Resolver::TypeCheckItem::visit(Rust::HIR::ImplBlock&)
../../gcc/rust/typecheck/rust-hir-type-check-item.cc:506
0xf7dbb7 Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
../../gcc/rust/typecheck/rust-hir-type-check-item.cc:59
0xf1518b Rust::Resolver::TypeResolution::Resolve(Rust::HIR::Crate&)
../../gcc/rust/typecheck/rust-hir-type-check.cc:75
0xce8f73 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
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 compiling the reduced Rust reproducer with the command provided and inspect resolve_path_to_trait in gcc/rust/typecheck/rust-hir-trait-resolve.cc around line 160, following the call path shown in the backtrace. Done means the reproducer no longer triggers an internal compiler error in the name-resolution 2.0 mode.
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
- Clearly specified
- Newbie friendliness
- 45/100