Skip to content

Commit 621d6f0

Browse files
Update compile-fail tests for error message deduplication.
1 parent 6fccd71 commit 621d6f0

File tree

50 files changed

+47
-139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+47
-139
lines changed

src/etc/generate-deriving-span-tests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
ENUM_TUPLE, ENUM_STRUCT, STRUCT_FIELDS, STRUCT_TUPLE = range(4)
7676

77-
def create_test_case(type, trait, super_traits, number_of_errors):
77+
def create_test_case(type, trait, super_traits, error_count):
7878
string = [ENUM_STRING, ENUM_STRUCT_VARIANT_STRING, STRUCT_STRING, STRUCT_TUPLE_STRING][type]
7979
all_traits = ','.join([trait] + super_traits)
8080
super_traits = ','.join(super_traits)
@@ -113,7 +113,7 @@ def write_file(name, string):
113113

114114
for (trait, supers, errs) in [('Clone', [], 1),
115115
('PartialEq', [], 2),
116-
('PartialOrd', ['PartialEq'], 9),
116+
('PartialOrd', ['PartialEq'], 3),
117117
('Eq', ['PartialEq'], 1),
118118
('Ord', ['Eq', 'PartialOrd', 'PartialEq'], 1),
119119
('Debug', [], 1),

src/test/compile-fail/E0017.rs

-6
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,9 @@ const C: i32 = 2;
1313

1414
const CR: &'static mut i32 = &mut C; //~ ERROR E0017
1515
//~| NOTE constants require immutable values
16-
//~| ERROR E0017
17-
//~| NOTE constants require immutable values
1816
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
19-
//~| NOTE statics require immutable values
20-
//~| ERROR E0017
2117
//~| NOTE statics require immutable values
2218
//~| ERROR cannot borrow
2319
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
2420
//~| NOTE statics require immutable values
25-
//~| ERROR E0017
26-
//~| NOTE statics require immutable values
2721
fn main() {}

src/test/compile-fail/E0388.rs

-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ static X: i32 = 1;
1212
const C: i32 = 2;
1313

1414
const CR: &'static mut i32 = &mut C; //~ ERROR E0017
15-
//~| ERROR E0017
1615
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
17-
//~| ERROR E0017
1816
//~| ERROR cannot borrow
1917
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
20-
//~| ERROR E0017
2118

2219
fn main() {}

src/test/compile-fail/borrowck/borrowck-overloaded-call.rs

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ fn f() {
6767
};
6868
let sp = &mut s;
6969
s(3); //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
70-
//~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
7170
}
7271

7372
fn g() {

src/test/compile-fail/borrowck/borrowck-unboxed-closures.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
fn a<F:Fn(isize, isize) -> isize>(mut f: F) {
1212
let g = &mut f;
1313
f(1, 2); //~ ERROR cannot borrow `f` as immutable
14-
//~^ ERROR cannot borrow `f` as immutable
1514
}
1615

1716
fn b<F:FnMut(isize, isize) -> isize>(f: F) {

src/test/compile-fail/check-static-immutable-mut-slices.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@
1212

1313
static TEST: &'static mut [isize] = &mut [];
1414
//~^ ERROR references in statics may only refer to immutable values
15-
//~^^ ERROR references in statics may only refer to immutable values
1615

1716
pub fn main() { }

src/test/compile-fail/const-err.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,14 @@ fn black_box<T>(_: T) {
2424
const FOO: u8 = [5u8][1];
2525
//~^ ERROR constant evaluation error
2626
//~| index out of bounds: the len is 1 but the index is 1
27-
//~^^^ ERROR constant evaluation error
28-
//~| index out of bounds: the len is 1 but the index is 1
2927

3028
fn main() {
3129
let a = -std::i8::MIN;
3230
//~^ WARN this expression will panic at run-time
3331
//~| attempt to negate with overflow
3432
let b = 200u8 + 200u8 + 200u8;
3533
//~^ WARN this expression will panic at run-time
36-
//~| attempt to add with overflow
37-
//~^^^ WARN this expression will panic at run-time
34+
//~^^ WARN this expression will panic at run-time
3835
//~| attempt to add with overflow
3936
let c = 200u8 * 4;
4037
//~^ WARN this expression will panic at run-time

src/test/compile-fail/const-err2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ fn main() {
2121
//~^ ERROR attempt to negate with overflow
2222
let b = 200u8 + 200u8 + 200u8;
2323
//~^ ERROR attempt to add with overflow
24-
//~| ERROR attempt to add with overflow
2524
let c = 200u8 * 4;
2625
//~^ ERROR attempt to multiply with overflow
2726
let d = 42u8 - (42u8 + 1);

src/test/compile-fail/cycle-trait-default-type-trait.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
trait Foo<X = Box<Foo>> {
1515
//~^ ERROR unsupported cyclic reference
16-
//~| ERROR unsupported cyclic reference
1716
}
1817

1918
fn main() { }

src/test/compile-fail/derives-span-Clone-enum-struct-variant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Clone-enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Clone-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Clone-tuple-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Debug-enum-struct-variant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Debug-enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Debug-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Debug-tuple-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Default-struct.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -15,7 +15,7 @@ struct Error;
1515

1616
#[derive(Default)]
1717
struct Struct {
18-
x: Error //~ ERROR `Error: std::default::Default` is not satisfied
18+
x: Error //~ ERROR
1919
}
2020

2121
fn main() {}

src/test/compile-fail/derives-span-Default-tuple-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Eq-enum-struct-variant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Eq-enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Eq-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Eq-tuple-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Hash-enum-struct-variant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Hash-enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Hash-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Hash-tuple-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Ord-enum-struct-variant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Ord-enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Ord-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-Ord-tuple-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-PartialEq-enum-struct-variant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-PartialEq-enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-PartialEq-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-PartialEq-tuple-struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//

src/test/compile-fail/derives-span-PartialOrd-enum-struct-variant.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -19,12 +19,6 @@ enum Enum {
1919
x: Error //~ ERROR
2020
//~^ ERROR
2121
//~^^ ERROR
22-
//~^^^ ERROR
23-
//~^^^^ ERROR
24-
//~^^^^^ ERROR
25-
//~^^^^^^ ERROR
26-
//~^^^^^^^ ERROR
27-
//~^^^^^^^^ ERROR
2822
}
2923
}
3024

src/test/compile-fail/derives-span-PartialOrd-enum.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -19,12 +19,6 @@ enum Enum {
1919
Error //~ ERROR
2020
//~^ ERROR
2121
//~^^ ERROR
22-
//~^^^ ERROR
23-
//~^^^^ ERROR
24-
//~^^^^^ ERROR
25-
//~^^^^^^ ERROR
26-
//~^^^^^^^ ERROR
27-
//~^^^^^^^^ ERROR
2822
)
2923
}
3024

src/test/compile-fail/derives-span-PartialOrd-struct.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -18,12 +18,6 @@ struct Struct {
1818
x: Error //~ ERROR
1919
//~^ ERROR
2020
//~^^ ERROR
21-
//~^^^ ERROR
22-
//~^^^^ ERROR
23-
//~^^^^^ ERROR
24-
//~^^^^^^ ERROR
25-
//~^^^^^^^ ERROR
26-
//~^^^^^^^^ ERROR
2721
}
2822

2923
fn main() {}

src/test/compile-fail/derives-span-PartialOrd-tuple-struct.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -18,12 +18,6 @@ struct Struct(
1818
Error //~ ERROR
1919
//~^ ERROR
2020
//~^^ ERROR
21-
//~^^^ ERROR
22-
//~^^^^ ERROR
23-
//~^^^^^ ERROR
24-
//~^^^^^^ ERROR
25-
//~^^^^^^^ ERROR
26-
//~^^^^^^^^ ERROR
2721
);
2822

2923
fn main() {}

src/test/compile-fail/feature-gate/issue-43106-gating-of-rustc_deprecated.rs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ mod rustc_deprecated {
2828

2929
#[rustc_deprecated = "1500"] struct S;
3030
//~^ ERROR stability attributes may not be used outside of the standard library
31-
//~| ERROR stability attributes may not be used outside of the standard library
3231

3332
#[rustc_deprecated = "1500"] type T = S;
3433
//~^ ERROR stability attributes may not be used outside of the standard library

src/test/compile-fail/feature-gate/issue-43106-gating-of-stable.rs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ mod stable {
2828

2929
#[stable = "1300"] struct S;
3030
//~^ ERROR stability attributes may not be used outside of the standard library
31-
//~| ERROR stability attributes may not be used outside of the standard library
3231

3332
#[stable = "1300"] type T = S;
3433
//~^ ERROR stability attributes may not be used outside of the standard library

src/test/compile-fail/feature-gate/issue-43106-gating-of-unstable.rs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ mod unstable {
2828

2929
#[unstable = "1200"] struct S;
3030
//~^ ERROR stability attributes may not be used outside of the standard library
31-
//~| ERROR stability attributes may not be used outside of the standard library
3231

3332
#[unstable = "1200"] type T = S;
3433
//~^ ERROR stability attributes may not be used outside of the standard library

src/test/compile-fail/issue-17718-const-bad-values.rs

-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010

1111
const C1: &'static mut [usize] = &mut [];
1212
//~^ ERROR: references in constants may only refer to immutable values
13-
//~| ERROR: references in constants may only refer to immutable values
1413

1514
static mut S: usize = 3;
1615
const C2: &'static mut usize = unsafe { &mut S };
1716
//~^ ERROR: constants cannot refer to statics
1817
//~| ERROR: references in constants may only refer to immutable values
1918
//~| ERROR: references in constants may only refer to immutable values
20-
//~| ERROR: references in constants may only refer to immutable values
2119

2220
fn main() {}

src/test/compile-fail/issue-20831-debruijn.rs

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ impl<'a> Publisher<'a> for MyStruct<'a> {
3838
fn subscribe(&mut self, t : Box<Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
3939
// Not obvious, but there is an implicit lifetime here -------^
4040
//~^^ ERROR cannot infer
41-
//~| ERROR cannot infer
4241
//
4342
// The fact that `Publisher` is using an implicit lifetime is
4443
// what was causing the debruijn accounting to be off, so

0 commit comments

Comments
 (0)