Skip to content

Compiler panic when deriving Debug for an enum #36670

Closed
@rt-tondilt

Description

@rt-tondilt

Compiler panics with the following code:

#[derive(Debug)]
enum SomeName {
    Abc(str),
}
fn main() {}
C:\Users\Kasutaja\Desktop\Viimane test>rustc viga.rs
viga.rs:2:1: 4:2 warning: enum is never used: `SomeName`, #[warn(dead_code)] on
by default
viga.rs:2 enum SomeName {
          ^
error: internal compiler error: ../src/librustc_trans\type_of.rs:178: Unexpected
 tail in unsized_info_ty: SomeName for ty=SomeName
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/m
aster/CONTRIBUTING.md#bug-reports
thread 'rustc' panicked at 'Box<Any>', ../src/librustc_errors/lib.rs:619
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Note that the enum has to contain a str. Adding more enum variants does not change the result.

I am only a foreign highschool student, so I tried my best to describe the bug. I also tried it using nightly compiler on the Rust playground and the results were the same. I hope that the playground expects the possibility of a compiler error and does not do anything bad.

Meta

rustc --version --verbose:

rustc 1.11.0 (9b21dcd6a 2016-08-15)
binary: rustc
commit-hash: 9b21dcd6a89f38e8ceccb2ede8c9027cb409f6e3
commit-date: 2016-08-15
host: x86_64-pc-windows-gnu
release: 1.11.0

The backtrace does not seem to be useful on Windows release builds. It only shows the following output and I don't know how to make it better.

stack backtrace:
   0:         0x6230006c - <unknown>
   1:         0x622ff527 - <unknown>
   2:         0x622c4de4 - <unknown>
   3:         0x64c07e8a - <unknown>
   4:         0x64c07770 - <unknown>
   // Lots of lines (28)

edit: I made a mistake in the title. As I said I derive Debug and not Display.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions