]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/binops-issue-22743.rs
New upstream version 1.37.0+dfsg1
[rustc.git] / src / test / run-pass / binops-issue-22743.rs
CommitLineData
c34b1796
AL
1use std::ops::Mul;
2
3#[derive(Copy, Clone)]
4pub struct Foo {
5 x: f64,
6}
7
8impl Mul<Foo> for f64 {
9 type Output = Foo;
10
11 fn mul(self, rhs: Foo) -> Foo {
12 // intentionally do something that is not *
13 Foo { x: self + rhs.x }
85aaf69f 14 }
223e47cc 15}
c34b1796
AL
16
17pub fn main() {
18 let f: Foo = Foo { x: 5.0 };
19 let val: f64 = 3.0;
20 let f2: Foo = val * f;
21 assert_eq!(f2.x, 8.0);
22}