Skip to content

NR2: ICE: in resolve_path_to_trait, at rust/typecheck/rust-hir-trait-resolve.cc:160 impl X for Y { type X = .. } #3669

Open
@matthiaskrgr

Description

@matthiaskrgr

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:

7651217

Possibly related line of code:

{
rust_error_at (path.get_locus (), "Failed to resolve path to hir-id");
return false;
}
auto resolved_item = mappings.lookup_hir_item (hid.value ());
rust_assert (resolved_item.has_value ());
if (resolved_item.value ()->get_item_kind () != HIR::Item::ItemKind::Trait)
{
rich_location r (line_table, path.get_locus ());
r.add_fixit_replace ("not a trait");
rust_error_at (r, ErrorCode::E0404, "Expected a trait found %qs",
path.as_simple_path ().as_string ().c_str ());

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions