Closed
Description
Here's a test program:
import comm::{port, chan, methods};
use std;
import std::arc;
enum e<T: send> { e2, e(chan<arc::arc<T>>) }
resource r<T: send>(x : comm::chan<e<T>>) {
x.send(e2);
}
fn foo<T: send const>(-x : T) -> r<T> {
fail
}
fn main() {
foo([some(1)]);
}
This gives an internal compiler error. The problem is that type variable leaks into trans. If I define a resource like arc::arc
in the same file and use that instead, the program compiles successfully. Here is some of the log from compiling this:
rust: "cleanup_and_leave: leaving [block 389]"
rust: "new insn_ctxt: cleanup_and_Br"
rust: "new insn_ctxt: cleanup_and_leave"
rust: "cleanup_and_leave: leaving [block 7fb923853d50]"
rust: "cleanup_and_leave: leaving [block 391]"
rust: "new insn_ctxt: finish_fn"
rust: "new insn_ctxt: tie_up_header_blocks"
rust: "new insn_ctxt: trans_args"
rust: "new insn_ctxt: alloc_ty"
rust: upcall fail 'Assertion !ty::type_has_params(t) failed', /Users/eholk/Documents/projects/mozilla/rust/src/rustc/middle/trans/base.rs:4233
The uninstantiated type variable is the data field in the arc.
Metadata
Metadata
Assignees
Labels
No labels