Skip to content

Commit 1a45e19

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 163439 b: refs/heads/snap-stage3 c: 2b17083 h: refs/heads/master i: 163437: ec12bd8 163435: c56a524 163431: 5565092 163423: 9b4e147 v: v3
1 parent 88b4d77 commit 1a45e19

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: fb1d4f1b1390654cdbe193882c9ed63a34dd720b
4+
refs/heads/snap-stage3: 2b170839880e82a72d463b00759c409cb61d41b0
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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.
4+
//
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.
10+
11+
// Test that binary operators consume their arguments
12+
13+
fn add<A: Add<B, ()>, B>(lhs: A, rhs: B) {
14+
lhs + rhs;
15+
drop(lhs); //~ ERROR use of moved value: `lhs`
16+
drop(rhs); //~ ERROR use of moved value: `rhs`
17+
}
18+
19+
fn sub<A: Sub<B, ()>, B>(lhs: A, rhs: B) {
20+
lhs - rhs;
21+
drop(lhs); //~ ERROR use of moved value: `lhs`
22+
drop(rhs); //~ ERROR use of moved value: `rhs`
23+
}
24+
25+
fn mul<A: Mul<B, ()>, B>(lhs: A, rhs: B) {
26+
lhs * rhs;
27+
drop(lhs); //~ ERROR use of moved value: `lhs`
28+
drop(rhs); //~ ERROR use of moved value: `rhs`
29+
}
30+
31+
fn div<A: Div<B, ()>, B>(lhs: A, rhs: B) {
32+
lhs / rhs;
33+
drop(lhs); //~ ERROR use of moved value: `lhs`
34+
drop(rhs); //~ ERROR use of moved value: `rhs`
35+
}
36+
37+
fn rem<A: Rem<B, ()>, B>(lhs: A, rhs: B) {
38+
lhs % rhs;
39+
drop(lhs); //~ ERROR use of moved value: `lhs`
40+
drop(rhs); //~ ERROR use of moved value: `rhs`
41+
}
42+
43+
fn bitand<A: BitAnd<B, ()>, B>(lhs: A, rhs: B) {
44+
lhs & rhs;
45+
drop(lhs); //~ ERROR use of moved value: `lhs`
46+
drop(rhs); //~ ERROR use of moved value: `rhs`
47+
}
48+
49+
fn bitor<A: BitOr<B, ()>, B>(lhs: A, rhs: B) {
50+
lhs | rhs;
51+
drop(lhs); //~ ERROR use of moved value: `lhs`
52+
drop(rhs); //~ ERROR use of moved value: `rhs`
53+
}
54+
55+
fn bitxor<A: BitXor<B, ()>, B>(lhs: A, rhs: B) {
56+
lhs ^ rhs;
57+
drop(lhs); //~ ERROR use of moved value: `lhs`
58+
drop(rhs); //~ ERROR use of moved value: `rhs`
59+
}
60+
61+
fn shl<A: Shl<B, ()>, B>(lhs: A, rhs: B) {
62+
lhs << rhs;
63+
drop(lhs); //~ ERROR use of moved value: `lhs`
64+
drop(rhs); //~ ERROR use of moved value: `rhs`
65+
}
66+
67+
fn shr<A: Shr<B, ()>, B>(lhs: A, rhs: B) {
68+
lhs >> rhs;
69+
drop(lhs); //~ ERROR use of moved value: `lhs`
70+
drop(rhs); //~ ERROR use of moved value: `rhs`
71+
}
72+
73+
fn main() {}

0 commit comments

Comments
 (0)