Skip to content

Instantly share code, notes, and snippets.

@MaikKlein
Created May 25, 2013 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaikKlein/5650789 to your computer and use it in GitHub Desktop.
Save MaikKlein/5650789 to your computer and use it in GitHub Desktop.
struct Vec3<T>{
mut x: T,
mut y: T,
mut z: T
}
impl<T: Add<T,T>+Clone> Vec3<T> {
fn add(&mut self,v: Vec3<T>){
self.x += v.x.clone();
self.y += v.y.clone();
self.z += v.z.clone();
}
}
fn main() {
let mut v1 : Vec3<int> = Vec3{x: 1,y: 1,z: 1,};
let mut v2 : Vec3<int> = Vec3{x: 1,y: 1,z: 1,};
v1.add(v2);
}
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
[Finished in 0.3s with exit code 101]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment