Closed
Description
While trying to port the bug case from #4775 forward to more modern Rust syntax, I hit the following ICE:
% cat /tmp/n.rs
fn echo<T>(x:T) { io::println(fmt!("%?", x)); }
pub trait OpInt<'self> { fn call(&'self self, int, int) -> int; }
impl<'self> OpInt for &'self fn(int,int) -> int {
fn call(&self, a:int, b:int) -> int {
echo("I dont wanna die!");
(*self)(a,b)
}
}
fn squarei<'a>(x:int, op:&'a OpInt) -> int { op.call(x, x) }
fn muli(x:int, y:int) -> int {
echo("You will never get here.");
x * y
}
fn main() {
echo("Entered main");
let f = |x,y|muli(x,y);
{
let g = &f;
let h = g as &OpInt;
let r = squarei(3, h); echo(r);
}
}
% RUST_LOG=rustc=1,::rt::backtrace rustc /tmp/n.rs
rust: task failed at 'assertion failed: self.variance.is_some()', /Users/fklock/Dev/Mozilla/rust.git/src/librustc/middle/typeck/rscope.rs:179
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /Users/fklock/Dev/Mozilla/rust.git/src/librustc/rustc.rc:349
rust: domain main @0x7f8af2008410 root task failed
%