Skip to content

segmentation fault #133922

Closed as duplicate of#133920
Closed as duplicate of#133920
@wxie7

Description

@wxie7

I tried this code:

rustc --crate-type staticlib -C link-dead-code -C debuginfo=2 file.rs
use std::mem::ManuallyDrop;
pub enum Foo<U> {
    Leaf(U),
    Branch(BoxedFoo<BoxedFoo<U>>),
}
pub type BoxedFoo<U> = ManuallyDrop<Box<Foo<U>>>;
pub fn drop() -> Foo<usize> {
    todo!()
}

Meta

rustc --version --verbose:

rustc 1.85.0-nightly (acabb5248 2024-12-04)
binary: rustc
commit-hash: acabb5248231987ae1f0c215208d1005a5db402d
commit-date: 2024-12-04
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.5
Backtrace

warning: variant `Recursive` is never constructed
 --> mutant.rs:3:5
  |
1 | enum Foo<T: 'static> {
  |      --- variant in this enum
2 |     Value(T),
3 |     Recursive(&'static Foo<Option<T>>),
  |     ^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

error: rustc interrupted by SIGSEGV, printing backtrace

/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x36d7fa3)[0x7926f32d7fa3]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7926ef842520]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(_RNvNtNtCskYQ3m3XnxIX_17rustc_codegen_ssa9debuginfo10type_names14push_item_name+0x9)[0x7926f4812b09]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(_RNvNtNtCskYQ3m3XnxIX_17rustc_codegen_ssa9debuginfo10type_names14push_item_name+0x1b3)[0x7926f4812cb3]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(_RNvNtNtCskYQ3m3XnxIX_17rustc_codegen_ssa9debuginfo10type_names14push_item_name+0x1b3)[0x7926f4812cb3]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x5198b39)[0x7926f4d98b39]

### cycle encountered after 6 frames with period 7
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
### recursed 35 times

/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]
/home/xieym/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0e1744037f1f9b04.so(+0x519827d)[0x7926f4d9827d]

note: rustc unexpectedly overflowed its stack! this is a bug
note: maximum backtrace depth reached, frames may have been lost
note: we would appreciate a report at https://github.com/rust-lang/rust
help: you can increase rustc's stack size by setting RUST_MIN_STACK=16777216
note: backtrace dumped due to SIGSEGV! resuming signal
[1]    430090 segmentation fault (core dumped)  rustc -C link-dead-code -C debuginfo=2 mutant.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions