Closed
Description
This code
#[crate_type = "lib"];
#[link(name = "foo", vers = "0.1")];
use std::cast;
trait A {}
struct B;
impl A for B {}
fn bar<T>(_: &mut A, _: &T) {}
fn foo<T>(t: &T) {
let b = B;
bar(unsafe { cast::transmute(&b as &A) }, t)
}
Dies with
error: internal compiler error: Cannot encode region variables
The transmute
is in place to get around #8248, but I think that this may be uncovering a separate issue. Even with the transmute, I think this should compile anyway (although it's still unsafe code).
cc @msullivan