rust/src/test/ui/issues/issue-3820.rs
2018-12-25 21:08:33 -07:00

16 lines
286 B
Rust

struct Thing {
x: isize
}
impl Thing {
fn mul(&self, c: &isize) -> Thing {
Thing {x: self.x * *c}
}
}
fn main() {
let u = Thing {x: 2};
let _v = u.mul(&3); // This is ok
let w = u * 3; //~ ERROR binary operation `*` cannot be applied to type `Thing`
}