Skip to content

Unboxed closures ICE: Expected(expected EBML doc with tag EsEnumVid but found tag 27) #18378

Closed
@carllerche

Description

@carllerche

This issue assumes the presence of PR #18144 (otherwise, it hits the issue resolved by the PR.

Reproducing requires building an rlib and then using the rlib:

foo.rs:

#![crate_type = "lib"]
#![feature(unboxed_closures)]

pub trait Foo<M: Send> : Send {
    fn receive(&mut self, msg: M);
}

pub struct Both<M, F> {
    m: M,
    f: F,
}

pub fn repro2<M: Send, F: Foo<M>>(both: Both<M, F>) {
    box move |:| {
        let Both { m, mut f } = both;
        f.receive(m);
    };
}

pub fn repro1<M: Send + Clone, F: Foo<M>>(foo: F, msg: M) {
    repro2(Both { m: msg, f: foo });
}

and using the lib:

extern crate foo;

use foo::Foo;

pub struct MyFoo;

impl Foo<&'static str> for MyFoo {
    fn receive(&mut self, msg: &'static str) {
        println!("hello: {}", msg);
    }
}

pub fn main() {
    foo::repro1(MyFoo, "Hello");
}

output:

$ rustc -L . ice.rs
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'called `Result::unwrap()` on an `Err` value: Expected(expected EBML doc with tag EsEnumVid but found tag 27)', /Users/carllerche/Code/oss/rust/src/libcore/result.rs:789

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions