Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
carllerche opened this issue Oct 27, 2014 · 4 comments · Fixed by #18546
Closed

Comments

@carllerche
Copy link
Member

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
@nikomatsakis
Copy link
Contributor

clearly a metadata issue

@bkoropoff
Copy link
Contributor

#16790 is also an unboxed closure metadata bug. I don't think there's been much cross-crate testing of the feature yet, so I expect there are a bunch of issues like this to shake out.

@nikomatsakis
Copy link
Contributor

cc @bkoropoff

@nikomatsakis
Copy link
Contributor

oops, sorry, github was being slow and I didn't see the comment.

@aturon aturon mentioned this issue Oct 28, 2014
47 tasks
bkoropoff added a commit to bkoropoff/rust that referenced this issue Nov 2, 2014
Closes rust-lang#18378.  Note that cross-crate unboxed closures are
still unimplemented and will fail to work currently.
bors added a commit that referenced this issue Nov 5, 2014
…=nick29581

This fixes some metadata/AST encoding problems that lead to ICEs.  The way this is currently handled will need revisiting if abstract return types are added, as unboxed closure types from extern crates could show up without being inlined into the local crate.

Closes #16790 (I think this was fixed earlier by accident and just needed a test case)
Closes #18378
Closes #18543

r? @pcwalton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants