ICE in visit, at rust/checks/errors/rust-unsafe-checker.cc:509
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 231
- Avg merge
- 20h 2m
- Merged PRs (30d)
- 66
Description
auto-reduced (treereduce-rust):
fn func() {
trait Trait {
const CONST: Self::MyType = main.field;
}
}
fn main() {}
original:
//~ ERROR cannot find value `bogus`
// Check that this doesn't ICE when processing associated const (type).
fn func() {
trait Trait {
type MyType;
const CONST: Self::MyType = main.field; //~ ERROR cannot find value `bogus`
}
}
fn main() {}
Version information:
34b0a681598d52de442a0a21c3a7df20bf1485bc
Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/34b0a681598d52de442a0a21c3a7df20bf1485bc/gcc/rust/checks/errors/rust-unsafe-checker.cc#L503-L515
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 visit, at rust/checks/errors/rust-unsafe-checker.cc:509
0x86e1db Rust::HIR::UnsafeChecker::visit(Rust::HIR::FieldAccessExpr&)
../../gcc/rust/checks/errors/rust-unsafe-checker.cc:509
0x86e1db Rust::HIR::UnsafeChecker::visit(Rust::HIR::FieldAccessExpr&)
../../gcc/rust/checks/errors/rust-unsafe-checker.cc:499
0xfb1183 Rust::HIR::UnsafeChecker::visit(Rust::HIR::Trait&)
../../gcc/rust/checks/errors/rust-unsafe-checker.cc:799
0xfb0e33 Rust::HIR::UnsafeChecker::visit(Rust::HIR::BlockExpr&)
../../gcc/rust/checks/errors/rust-unsafe-checker.cc:531
0xfb1ff3 Rust::HIR::UnsafeChecker::go(Rust::HIR::Crate&)
../../gcc/rust/checks/errors/rust-unsafe-checker.cc:44
0xc5c393 Rust::Session::compile_crate(char const*)
../../gcc/rust/rust-session-manager.cc:708
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
Reproduce the reduced Rust input with the command shown, then inspect rust/checks/errors/rust-unsafe-checker.cc around lines 499-509 and the visitor path through the trait. Done means the associated-const field access no longer triggers an internal compiler error and produces the expected diagnostic behavior.
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
- 52/100