Skip to content

ICE with mutually recursive infinite-sized type and enum from another module #57271

Closed
@XavilPergis

Description

@XavilPergis

I'm getting a very touchy ICE on rustc 1.33.0-nightly (9eac38634 2018-12-31) running on x86_64-unknown-linux-gnu. I'm not 100% sure what it has to do with...

Here is the minimum example I can trigger the ICE with:

// in `crate::signature` / `src/signature.rs`
use crate::field::BaseType;

pub enum ObjectType {
    Class(ClassTypeSignature),
    Array(TypeSignature),
    TypeVariable(()),
}

pub struct ClassTypeSignature {
    pub package: (),
    pub class: (),
    pub inner: (),
}

pub enum TypeSignature {
    Base(BaseType),
    Object(ObjectType),
}

// in `crate::field` / `src/field.rs`
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub enum BaseType {
    Byte,
    Char,
    Double,
    Float,
    Int,
    Long,
    Short,
    Boolean,
}

I'm expecting to see an error about an infinitely-sized type, but instead the compiler crashes. Changes that make the compiler not ICE:

  • Moving field::BaseType into signature
  • Making ObjectType/TypeSignature not mutually recursive
  • Rearranging or removing any field/variant from any of these structs/enums
  • Making ObjectType::Class not contain ClassTypeSignature

Output of RUST_BACKTRACE=1 cargo build: https://gist.github.com/XavilPergis/102774c6c542403db10a351ff013f356
Original code that ICE'd: https://gist.github.com/XavilPergis/dafc2bb478f18cee700f78e16eea81cd

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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