Skip to content

Commit 53618c3

Browse files
committed
test traits defined on ranges
1 parent 9e78cd7 commit 53618c3

7 files changed

+205
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// Copyright 2016 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+
#![feature(inclusive_range)]
12+
13+
use std::ops::*;
14+
15+
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
16+
struct AllTheRanges {
17+
a: Range<usize>,
18+
//~^ ERROR PartialOrd
19+
//~^^ ERROR PartialOrd
20+
//~^^^ ERROR Ord
21+
//~^^^^ ERROR binary operation
22+
//~^^^^^ ERROR binary operation
23+
//~^^^^^^ ERROR binary operation
24+
//~^^^^^^^ ERROR binary operation
25+
//~^^^^^^^^ ERROR binary operation
26+
//~^^^^^^^^^ ERROR binary operation
27+
//~^^^^^^^^^^ ERROR binary operation
28+
//~^^^^^^^^^^^ ERROR binary operation
29+
b: RangeTo<usize>,
30+
//~^ ERROR PartialOrd
31+
//~^^ ERROR PartialOrd
32+
//~^^^ ERROR Ord
33+
//~^^^^ ERROR binary operation
34+
//~^^^^^ ERROR binary operation
35+
//~^^^^^^ ERROR binary operation
36+
//~^^^^^^^ ERROR binary operation
37+
//~^^^^^^^^ ERROR binary operation
38+
//~^^^^^^^^^ ERROR binary operation
39+
//~^^^^^^^^^^ ERROR binary operation
40+
//~^^^^^^^^^^^ ERROR binary operation
41+
c: RangeFrom<usize>,
42+
//~^ ERROR PartialOrd
43+
//~^^ ERROR PartialOrd
44+
//~^^^ ERROR Ord
45+
//~^^^^ ERROR binary operation
46+
//~^^^^^ ERROR binary operation
47+
//~^^^^^^ ERROR binary operation
48+
//~^^^^^^^ ERROR binary operation
49+
//~^^^^^^^^ ERROR binary operation
50+
//~^^^^^^^^^ ERROR binary operation
51+
//~^^^^^^^^^^ ERROR binary operation
52+
//~^^^^^^^^^^^ ERROR binary operation
53+
d: RangeFull,
54+
//~^ ERROR PartialOrd
55+
//~^^ ERROR PartialOrd
56+
//~^^^ ERROR Ord
57+
//~^^^^ ERROR binary operation
58+
//~^^^^^ ERROR binary operation
59+
//~^^^^^^ ERROR binary operation
60+
//~^^^^^^^ ERROR binary operation
61+
//~^^^^^^^^ ERROR binary operation
62+
//~^^^^^^^^^ ERROR binary operation
63+
//~^^^^^^^^^^ ERROR binary operation
64+
//~^^^^^^^^^^^ ERROR binary operation
65+
e: RangeInclusive<usize>,
66+
//~^ ERROR PartialOrd
67+
//~^^ ERROR PartialOrd
68+
//~^^^ ERROR Ord
69+
//~^^^^ ERROR binary operation
70+
//~^^^^^ ERROR binary operation
71+
//~^^^^^^ ERROR binary operation
72+
//~^^^^^^^ ERROR binary operation
73+
//~^^^^^^^^ ERROR binary operation
74+
//~^^^^^^^^^ ERROR binary operation
75+
//~^^^^^^^^^^ ERROR binary operation
76+
//~^^^^^^^^^^^ ERROR binary operation
77+
f: RangeToInclusive<usize>,
78+
//~^ ERROR PartialOrd
79+
//~^^ ERROR PartialOrd
80+
//~^^^ ERROR Ord
81+
//~^^^^ ERROR binary operation
82+
//~^^^^^ ERROR binary operation
83+
//~^^^^^^ ERROR binary operation
84+
//~^^^^^^^ ERROR binary operation
85+
//~^^^^^^^^ ERROR binary operation
86+
//~^^^^^^^^^ ERROR binary operation
87+
//~^^^^^^^^^^ ERROR binary operation
88+
//~^^^^^^^^^^^ ERROR binary operation
89+
}
90+
91+
fn main() {}
92+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2016 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+
use std::ops::*;
12+
13+
#[derive(Copy, Clone)] //~ ERROR Copy
14+
struct R(Range<usize>);
15+
16+
fn main() {}
17+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2016 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+
use std::ops::*;
12+
13+
#[derive(Copy, Clone)] //~ ERROR Copy
14+
struct R(RangeFrom<usize>);
15+
16+
fn main() {}
17+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2016 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+
#![feature(rustc_attrs)]
12+
13+
use std::ops::*;
14+
15+
#[derive(Copy, Clone)]
16+
struct R(RangeTo<usize>);
17+
18+
#[rustc_error]
19+
fn main() {} //~ ERROR success
20+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2016 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+
#![feature(rustc_attrs)]
12+
13+
use std::ops::*;
14+
15+
#[derive(Copy, Clone)]
16+
struct R(RangeFull);
17+
18+
#[rustc_error]
19+
fn main() {} //~ ERROR success
20+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2016 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+
#![feature(inclusive_range)]
12+
13+
use std::ops::*;
14+
15+
#[derive(Copy, Clone)] //~ ERROR Copy
16+
struct R(RangeInclusive<usize>);
17+
18+
fn main() {}
19+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2016 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+
#![feature(rustc_attrs, inclusive_range)]
12+
13+
use std::ops::*;
14+
15+
#[derive(Copy, Clone)]
16+
struct R(RangeToInclusive<usize>);
17+
18+
#[rustc_error]
19+
fn main() {} //~ ERROR success
20+

0 commit comments

Comments
 (0)