diff --git a/src/test/compile-fail/range_traits-1.rs b/src/test/compile-fail/range_traits-1.rs new file mode 100644 index 00000000000..8eff20345f5 --- /dev/null +++ b/src/test/compile-fail/range_traits-1.rs @@ -0,0 +1,92 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(inclusive_range)] + +use std::ops::*; + +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] +struct AllTheRanges { + a: Range, + //~^ ERROR PartialOrd + //~^^ ERROR PartialOrd + //~^^^ ERROR Ord + //~^^^^ ERROR binary operation + //~^^^^^ ERROR binary operation + //~^^^^^^ ERROR binary operation + //~^^^^^^^ ERROR binary operation + //~^^^^^^^^ ERROR binary operation + //~^^^^^^^^^ ERROR binary operation + //~^^^^^^^^^^ ERROR binary operation + //~^^^^^^^^^^^ ERROR binary operation + b: RangeTo, + //~^ ERROR PartialOrd + //~^^ ERROR PartialOrd + //~^^^ ERROR Ord + //~^^^^ ERROR binary operation + //~^^^^^ ERROR binary operation + //~^^^^^^ ERROR binary operation + //~^^^^^^^ ERROR binary operation + //~^^^^^^^^ ERROR binary operation + //~^^^^^^^^^ ERROR binary operation + //~^^^^^^^^^^ ERROR binary operation + //~^^^^^^^^^^^ ERROR binary operation + c: RangeFrom, + //~^ ERROR PartialOrd + //~^^ ERROR PartialOrd + //~^^^ ERROR Ord + //~^^^^ ERROR binary operation + //~^^^^^ ERROR binary operation + //~^^^^^^ ERROR binary operation + //~^^^^^^^ ERROR binary operation + //~^^^^^^^^ ERROR binary operation + //~^^^^^^^^^ ERROR binary operation + //~^^^^^^^^^^ ERROR binary operation + //~^^^^^^^^^^^ ERROR binary operation + d: RangeFull, + //~^ ERROR PartialOrd + //~^^ ERROR PartialOrd + //~^^^ ERROR Ord + //~^^^^ ERROR binary operation + //~^^^^^ ERROR binary operation + //~^^^^^^ ERROR binary operation + //~^^^^^^^ ERROR binary operation + //~^^^^^^^^ ERROR binary operation + //~^^^^^^^^^ ERROR binary operation + //~^^^^^^^^^^ ERROR binary operation + //~^^^^^^^^^^^ ERROR binary operation + e: RangeInclusive, + //~^ ERROR PartialOrd + //~^^ ERROR PartialOrd + //~^^^ ERROR Ord + //~^^^^ ERROR binary operation + //~^^^^^ ERROR binary operation + //~^^^^^^ ERROR binary operation + //~^^^^^^^ ERROR binary operation + //~^^^^^^^^ ERROR binary operation + //~^^^^^^^^^ ERROR binary operation + //~^^^^^^^^^^ ERROR binary operation + //~^^^^^^^^^^^ ERROR binary operation + f: RangeToInclusive, + //~^ ERROR PartialOrd + //~^^ ERROR PartialOrd + //~^^^ ERROR Ord + //~^^^^ ERROR binary operation + //~^^^^^ ERROR binary operation + //~^^^^^^ ERROR binary operation + //~^^^^^^^ ERROR binary operation + //~^^^^^^^^ ERROR binary operation + //~^^^^^^^^^ ERROR binary operation + //~^^^^^^^^^^ ERROR binary operation + //~^^^^^^^^^^^ ERROR binary operation +} + +fn main() {} + diff --git a/src/test/compile-fail/range_traits-2.rs b/src/test/compile-fail/range_traits-2.rs new file mode 100644 index 00000000000..64fcd25f538 --- /dev/null +++ b/src/test/compile-fail/range_traits-2.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::ops::*; + +#[derive(Copy, Clone)] //~ ERROR Copy +struct R(Range); + +fn main() {} + diff --git a/src/test/compile-fail/range_traits-3.rs b/src/test/compile-fail/range_traits-3.rs new file mode 100644 index 00000000000..d26b7956ae8 --- /dev/null +++ b/src/test/compile-fail/range_traits-3.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::ops::*; + +#[derive(Copy, Clone)] //~ ERROR Copy +struct R(RangeFrom); + +fn main() {} + diff --git a/src/test/compile-fail/range_traits-4.rs b/src/test/compile-fail/range_traits-4.rs new file mode 100644 index 00000000000..630969bdbdf --- /dev/null +++ b/src/test/compile-fail/range_traits-4.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(rustc_attrs)] + +use std::ops::*; + +#[derive(Copy, Clone)] +struct R(RangeTo); + +#[rustc_error] +fn main() {} //~ ERROR success + diff --git a/src/test/compile-fail/range_traits-5.rs b/src/test/compile-fail/range_traits-5.rs new file mode 100644 index 00000000000..5963c4a9496 --- /dev/null +++ b/src/test/compile-fail/range_traits-5.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(rustc_attrs)] + +use std::ops::*; + +#[derive(Copy, Clone)] +struct R(RangeFull); + +#[rustc_error] +fn main() {} //~ ERROR success + diff --git a/src/test/compile-fail/range_traits-6.rs b/src/test/compile-fail/range_traits-6.rs new file mode 100644 index 00000000000..7c62711feae --- /dev/null +++ b/src/test/compile-fail/range_traits-6.rs @@ -0,0 +1,19 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(inclusive_range)] + +use std::ops::*; + +#[derive(Copy, Clone)] //~ ERROR Copy +struct R(RangeInclusive); + +fn main() {} + diff --git a/src/test/compile-fail/range_traits-7.rs b/src/test/compile-fail/range_traits-7.rs new file mode 100644 index 00000000000..b6fec773a77 --- /dev/null +++ b/src/test/compile-fail/range_traits-7.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(rustc_attrs, inclusive_range)] + +use std::ops::*; + +#[derive(Copy, Clone)] +struct R(RangeToInclusive); + +#[rustc_error] +fn main() {} //~ ERROR success +