1 // Test that binary operators consume their arguments
3 use std
::ops
::{Add, Sub, Mul, Div, Rem, BitAnd, BitXor, BitOr, Shl, Shr}
;
5 fn add
<A
: Add
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
7 drop(lhs
); //~ ERROR use of moved value: `lhs`
8 drop(rhs
); //~ ERROR use of moved value: `rhs`
11 fn sub
<A
: Sub
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
13 drop(lhs
); //~ ERROR use of moved value: `lhs`
14 drop(rhs
); //~ ERROR use of moved value: `rhs`
17 fn mul
<A
: Mul
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
19 drop(lhs
); //~ ERROR use of moved value: `lhs`
20 drop(rhs
); //~ ERROR use of moved value: `rhs`
23 fn div
<A
: Div
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
25 drop(lhs
); //~ ERROR use of moved value: `lhs`
26 drop(rhs
); //~ ERROR use of moved value: `rhs`
29 fn rem
<A
: Rem
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
31 drop(lhs
); //~ ERROR use of moved value: `lhs`
32 drop(rhs
); //~ ERROR use of moved value: `rhs`
35 fn bitand
<A
: BitAnd
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
37 drop(lhs
); //~ ERROR use of moved value: `lhs`
38 drop(rhs
); //~ ERROR use of moved value: `rhs`
41 fn bitor
<A
: BitOr
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
43 drop(lhs
); //~ ERROR use of moved value: `lhs`
44 drop(rhs
); //~ ERROR use of moved value: `rhs`
47 fn bitxor
<A
: BitXor
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
49 drop(lhs
); //~ ERROR use of moved value: `lhs`
50 drop(rhs
); //~ ERROR use of moved value: `rhs`
53 fn shl
<A
: Shl
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
55 drop(lhs
); //~ ERROR use of moved value: `lhs`
56 drop(rhs
); //~ ERROR use of moved value: `rhs`
59 fn shr
<A
: Shr
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
61 drop(lhs
); //~ ERROR use of moved value: `lhs`
62 drop(rhs
); //~ ERROR use of moved value: `rhs`