Closed
Description
OS: Ubuntu 12.04 x86
rustc -v Collision.rs:
rustc 0.9-pre (b8c87fd 2013-12-24 01:56:30 -0800)
host: i686-unknown-linux-gnu
Full error message:
Collision.rs:30:3: 30:14 error: binary operation + cannot be applied to type Vec2
Collision.rs:30 *v += *move;
^~~~~~~~~~~
error: internal compiler error: no type for node 81: expr move (id=81) in fcx 0xb3970ef8
This message reflects a bug in the Rust compiler.
We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report
task 'rustc' failed at 'explicit failure', /home/duncan/Code/rust/src/libsyntax/diagnostic.rs:102
task '
Source:
struct Vec2
{
x: f32,
y: f32
}
impl Add<Vec2, Vec2> for Vec2
{
fn add(&self, v2: &Vec2) -> Vec2
{
Vec2
{
x: self.x + v2.x,
y: self.y + v2.y
}
}
}
struct Polygon
{
vertices: ~[Vec2]
}
impl Polygon
{
fn translate(&mut self, move: &Vec2)
{
for v in self.vertices.mut_iter()
{
*v += *move;
}
}
}
fn main()
{
return;
}