Skip to content

internal compiler error: drop_ty_immediate: non-box ty #9446

Closed
@dcrewi

Description

@dcrewi

Minimal test case:

struct Wrapper(~str);

impl Wrapper {
    pub fn new() -> Wrapper {
        Wrapper(~"Bob")
    }

    pub fn say_hi(&self) {
        println(fmt!("hello %s", **self));
    }
}

impl Drop for Wrapper {
    fn drop(&mut self) {}
}

fn main() {
    {
        // This runs without complaint.
        let x = Wrapper::new();
        x.say_hi();
    }
    {
        // This fails to compile.
        // error: internal compiler error: drop_ty_immediate: non-box ty
        Wrapper::new().say_hi();
    }
}

I originally ran accross this when wrapping a *T, but it also fails when I try to wrap int and other numeric types, bool, Option<T>, ~T, and other structs that also wrap a single value of those types.

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