rust/src/test/ui/issues/issue-3820.rs

16 lines
270 B
Rust
Raw Normal View History

2013-01-10 21:44:27 +00:00
struct Thing {
x: isize
2013-01-10 21:44:27 +00:00
}
impl Thing {
fn mul(&self, c: &isize) -> Thing {
2013-01-10 21:44:27 +00:00
Thing {x: self.x * *c}
}
}
fn main() {
let u = Thing {x: 2};
let _v = u.mul(&3); // This is ok
2019-12-11 22:11:32 +00:00
let w = u * 3; //~ ERROR cannot multiply `{integer}` to `Thing`
2013-01-10 21:44:27 +00:00
}