1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Test that binary operators consume their arguments
13 use std
::ops
::{Add, Sub, Mul, Div, Rem, BitAnd, BitXor, BitOr, Shl, Shr}
;
15 fn add
<A
: Add
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
17 drop(lhs
); //~ ERROR use of moved value: `lhs`
18 drop(rhs
); //~ ERROR use of moved value: `rhs`
21 fn sub
<A
: Sub
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
23 drop(lhs
); //~ ERROR use of moved value: `lhs`
24 drop(rhs
); //~ ERROR use of moved value: `rhs`
27 fn mul
<A
: Mul
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
29 drop(lhs
); //~ ERROR use of moved value: `lhs`
30 drop(rhs
); //~ ERROR use of moved value: `rhs`
33 fn div
<A
: Div
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
35 drop(lhs
); //~ ERROR use of moved value: `lhs`
36 drop(rhs
); //~ ERROR use of moved value: `rhs`
39 fn rem
<A
: Rem
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
41 drop(lhs
); //~ ERROR use of moved value: `lhs`
42 drop(rhs
); //~ ERROR use of moved value: `rhs`
45 fn bitand
<A
: BitAnd
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
47 drop(lhs
); //~ ERROR use of moved value: `lhs`
48 drop(rhs
); //~ ERROR use of moved value: `rhs`
51 fn bitor
<A
: BitOr
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
53 drop(lhs
); //~ ERROR use of moved value: `lhs`
54 drop(rhs
); //~ ERROR use of moved value: `rhs`
57 fn bitxor
<A
: BitXor
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
59 drop(lhs
); //~ ERROR use of moved value: `lhs`
60 drop(rhs
); //~ ERROR use of moved value: `rhs`
63 fn shl
<A
: Shl
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
65 drop(lhs
); //~ ERROR use of moved value: `lhs`
66 drop(rhs
); //~ ERROR use of moved value: `rhs`
69 fn shr
<A
: Shr
<B
, Output
=()>, B
>(lhs
: A
, rhs
: B
) {
71 drop(lhs
); //~ ERROR use of moved value: `lhs`
72 drop(rhs
); //~ ERROR use of moved value: `rhs`