Rust-GCC / Rust-GCC/gccrs

ICE `failed to lookup hir item during refutability checks`

Open
#4,732 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 -frust-crate-attr=no_core
pub struct Foo {
    bar: u8,
    baa: [u32; 1],
}

const FOOMP: Foo = Foo {
    bar: 0,
    baa: [69; 1],
};

fn main() {
    let FOOMP = FOOMP;
}

original:

//@ check-pass
//@ compile-flags: -Zextra-const-ub-checks

#[repr(packed)]
pub struct Foo {
    bar: u8,
    baa: [u32; 1],
}

const FOOMP: Foo = Foo {
    bar: 0,
    baa: [69; 1],
};

fn main() {
    let FOOMP = FOOMP;
}

Version information:

c539964b8cc842e871d77b45150df6a5882335fb

Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use -frust-crate-attr=no_core -frust-crate-attr=feature(no_core)

Program output

crab1: internal compiler error: at mvce.rs:12:9, failed to lookup hir item during refutability checks
0x32edd17 internal_error(char const*, ...)
	../../gcc/diagnostic-global-context.cc:787
0xd0ad8a rust_be_internal_error_at(unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
	../../gcc/rust/rust-diagnostics.cc:173
0xd0ae4d rust_internal_error_at(unsigned long, char const*, ...)
	../../gcc/rust/rust-diagnostics.cc:182
0x11ac592 Rust::HIR::PathPattern::is_refutable(Rust::TyTy::BaseType const&) const
	../../gcc/rust/hir/tree/rust-hir-pattern-abstract.cc:68
0x1199a59 Rust::Analysis::PatternChecker::visit(Rust::HIR::LetStmt&)
	../../gcc/rust/checks/errors/rust-hir-pattern-analysis.cc:702
0x1199593 Rust::Analysis::PatternChecker::visit(Rust::HIR::BlockExpr&)
	../../gcc/rust/checks/errors/rust-hir-pattern-analysis.cc:281
0x119a4e3 Rust::Analysis::PatternChecker::go(Rust::HIR::Crate&)
	../../gcc/rust/checks/errors/rust-hir-pattern-analysis.cc:46
0xecc43b Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:815
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 /tmp/icemaker_global_tempdir.YDWciJ2vfL70/rustc_testrunner_tmpdir_reporting.zmDxqE3hvFbC/mvce.rs -o/tmp/icemaker_global_tempdir.YDWciJ2vfL70/rustc_testrunner_tmpdir_reporting.zmDxqE3hvFbC/binaryname -frust-incomplete-and-experimental-compiler-do-not-use -frust-crate-attr=no_core -frust-crate-attr=feature(no_core)
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

Reproduce the reduced Rust program with the reported compiler flags, then start at Rust::HIR::PathPattern::is_refutable in gcc/rust/hir/tree/rust-hir-pattern-abstract.cc:68 and follow its call from PatternChecker in rust-hir-pattern-analysis.cc:702. Done means the program no longer triggers the internal compiler error during refutability checks; the payload does not name a regression test location.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.