Skip to content

Instantly share code, notes, and snippets.

@pnkfelix
Created February 3, 2013 22:50
Show Gist options
  • Save pnkfelix/4704081 to your computer and use it in GitHub Desktop.
Save pnkfelix/4704081 to your computer and use it in GitHub Desktop.
rustc ICE with by-value self
% rustc -v
rustc 0.6 (77ee858 2013-02-02 11:54:29 +0100)
host: x86_64-apple-darwin
% cat bug3.rs
pub trait Op<T> { fn call(self, T,T) -> T; }
impl<T> fn(T,T) -> T : Op<T> {
fn call(self, a:T, b:T) -> T { self(a,b) }
}
fn square<T : Copy>(x:T, op:Op<T>) -> T { op.call(x, x) }
fn main() {
let r = square(3, (|x:int,y:int|x*y) as Op::<int>); io::println(fmt!("%d", r))
}
% rustc bug3.rs
error: internal compiler error: methods with by-value self should not be called on objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment