segfault `Rust::TyTy::VariantDef::as_string`
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):
//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use -frust-crate-attr=no_core
struct Apple;
enum Delicious {
ApplePie = Apple::PIE,
}
original:
struct Apple;
enum Delicious {
ApplePie = Apple::PIE,
}
fn main() {}
Version information:
696cb485cfa9969c952d6765889d82ed548ca15c
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
/tmp/icemaker_global_tempdir.RY1PwrhEurnc/rustc_testrunner_tmpdir_reporting.9ZrSqs6EnYBu/mvce.rs:4:23: error: failed to resolve path segment using an impl Probe
4 | ApplePie = Apple::PIE,
| ^~~
crab1: internal compiler error: Segmentation fault
0x32c0107 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:787
0x1a7e17f crash_signal
../../gcc/toplev.cc:325
0x1038837 Rust::TyTy::VariantDef::as_string[abi:cxx11]() const
../../gcc/rust/typecheck/rust-tyty.cc:1685
0x1039140 Rust::TyTy::ADTType::as_string[abi:cxx11]() const
../../gcc/rust/typecheck/rust-tyty.cc:1821
0x106a5b2 Rust::TyTy::VarianceAnalysis::GenericTyVisitorCtx::process_type(Rust::TyTy::ADTType&)
../../gcc/rust/typecheck/rust-tyty-variance-analysis.cc:234
0x106aba7 Rust::TyTy::VarianceAnalysis::GenericTyPerCrateCtx::process_type(Rust::TyTy::ADTType&)
../../gcc/rust/typecheck/rust-tyty-variance-analysis.cc:131
0x106aba7 Rust::TyTy::VarianceAnalysis::CrateCtx::add_type_constraints(Rust::TyTy::ADTType&)
../../gcc/rust/typecheck/rust-tyty-variance-analysis.cc:26
0x10a3d6f Rust::Resolver::TypeCheckItem::visit(Rust::HIR::Enum&)
../../gcc/rust/typecheck/rust-hir-type-check-item.cc:446
0x109749c Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
../../gcc/rust/typecheck/rust-hir-type-check-item.cc:60
0x1027e1b Rust::Resolver::TypeResolution::Resolve(Rust::HIR::Crate&)
../../gcc/rust/typecheck/rust-hir-type-check.cc:72
0xec74c9 Rust::Session::compile_crate(char const*)
../../gcc/rust/rust-session-manager.cc:804
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 /tmp/icemaker_global_tempdir.RY1PwrhEurnc/rustc_testrunner_tmpdir_reporting.9ZrSqs6EnYBu/mvce.rs -o/tmp/icemaker_global_tempdir.RY1PwrhEurnc/rustc_testrunner_tmpdir_reporting.9ZrSqs6EnYBu/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
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 crash with the reduced Rust program and the listed compiler flags. Read Rust::TyTy::VariantDef::as_string in gcc/rust/typecheck/rust-tyty.cc, then follow its callers in rust-tyty-variance-analysis.cc and rust-hir-type-check-item.cc. Done means the reproducer reports the resolution error without a segmentation fault and has regression coverage.
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
- Clearly specified
- Newbie friendliness
- 70/100