Skip to content

Commit e517478

Browse files
author
Nick Hamann
committed
Fix many tests.
Fallout from the change to compiletest that makes it not ignore compiler errors that don't have an error pattern.
1 parent 1deefe5 commit e517478

File tree

138 files changed

+420
-378
lines changed

Some content is hidden

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

138 files changed

+420
-378
lines changed
+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,8 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: parameters were supplied
12-
1311
fn f(x: isize) { }
1412

15-
fn main() { let i: (); i = f(); }
13+
fn main() {
14+
let i: ();
15+
i = f(); //~ ERROR this function takes 1 parameter but 0 parameters were supplied
16+
}
+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -9,8 +9,9 @@
99
// except according to those terms.
1010

1111

12-
// error-pattern: mismatched types
13-
1412
fn f(x: isize) { }
1513

16-
fn main() { let i: (); i = f(()); }
14+
fn main() {
15+
let i: ();
16+
i = f(()); //~ ERROR mismatched types
17+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: expected item
12-
1311
#![attr = "val"]
1412
#[attr = "val"] // Unterminated
13+
//~^ ERROR expected item after attributes
+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,9 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: can't capture dynamic environment in a fn item;
1211
fn foo() {
1312
let x: isize;
14-
fn bar() { log(debug, x); }
13+
fn bar() {
14+
println!("{}", x);
15+
//~^ ERROR can't capture dynamic environment in a fn item; use the || { ... } closure
16+
// form instead
17+
//~| ERROR unresolved name `x`
18+
}
1519
}
1620
fn main() { foo(); }
+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,8 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: can't capture dynamic environment in a fn item;
1211
fn foo(x: isize) {
13-
fn bar() { log(debug, x); }
12+
fn bar() {
13+
println!("{}", x);
14+
//~^ ERROR can't capture dynamic environment in a fn item; use the || { ... } closure
15+
// form instead
16+
//~| ERROR unresolved name `x`
17+
}
1418
}
1519
fn main() { foo(2); }

src/test/compile-fail/bad-env-capture3.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,10 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: can't capture dynamic environment in a fn item;
1211
fn foo(x: isize) {
1312
fn mth() {
14-
fn bar() { log(debug, x); }
13+
fn bar() {
14+
println!("{}", x);
15+
//~^ ERROR can't capture dynamic environment in a fn item; use the || { ... } closure
16+
// form instead
17+
//~| ERROR unresolved name `x`
18+
}
1519
}
1620
}
1721

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,8 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: unresolved name `m1::arguments`. Did you mean `arguments`?
12-
1311
mod m1 {}
1412

15-
fn main(arguments: Vec<String>) { log(debug, m1::arguments); }
13+
fn main(arguments: Vec<String>) {
14+
println!("{:?}", m1::arguments);
15+
//~^ ERROR unresolved name `m1::arguments`. Did you mean `arguments`?
16+
}
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,12 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: unresolved name `m1::arguments`. Did you mean `arguments`?
12-
1311
mod m1 {
1412
pub mod arguments {}
1513
}
1614

1715
fn main(arguments: Vec<String>) {
18-
log(debug, m1::arguments);
16+
println!("{:?}", m1::arguments);
17+
//~^ ERROR unresolved name `m1::arguments`. Did you mean `arguments`?
1918
}

src/test/compile-fail/bad-module.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: unresolved name
12-
13-
fn main() { let foo = thing::len(Vec::new()); }
11+
fn main() {
12+
let foo = thing::len(Vec::new());
13+
//~^ ERROR failed to resolve. Use of undeclared type or module `thing`
14+
//~| ERROR unresolved name `thing::len`
15+
}
+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,6 +8,5 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:`^` cannot be applied to type `collections::string::String`
12-
1311
fn main() { let x = "a".to_string() ^ "b".to_string(); }
12+
//~^ ERROR binary operation `^` cannot be applied to type `collections::string::String`
+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,6 +8,5 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:`*` cannot be applied to type `bool`
12-
1311
fn main() { let x = true * false; }
12+
//~^ ERROR binary operation `*` cannot be applied to type `bool`

src/test/compile-fail/bogus-tag.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,15 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
12-
// error-pattern: unresolved
13-
1411
enum color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), }
1512

1613
fn main() {
17-
let red: color = rgb(255, 0, 0);
14+
let red: color = rgb(255, 0, 0); //~ ERROR unresolved name `rgb`
1815
match red {
19-
rgb(r, g, b) => { println!("rgb"); }
20-
hsl(h, s, l) => { println!("hsl"); }
16+
rgb(r, g, b) => { println!("rgb"); } //~ ERROR unresolved enum variant, struct or const `rgb`
17+
hsl(h, s, l) => { println!("hsl"); } //~ ERROR unresolved enum variant, struct or const `hsl`
2118
}
2219
}

src/test/compile-fail/capture1.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,10 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
12-
// error-pattern: can't capture dynamic environment in a fn item;
13-
1411
fn main() {
1512
let bar: isize = 5;
1613
fn foo() -> isize { return bar; }
14+
//~^ ERROR can't capture dynamic environment in a fn item; use the || { ... } closure
15+
// form instead
16+
//~| ERROR unresolved name `bar`
1717
}

src/test/compile-fail/cast-as-bool.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2015 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
//
@@ -8,5 +8,4 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: cannot cast as `bool`, compare with zero instead
12-
fn main() { let u = (5 as bool); }
11+
fn main() { let u = (5 as bool); } //~ ERROR cannot cast as `bool`, compare with zero instead
+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,5 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: non-scalar cast: `()` as `u32`
12-
fn main() { let u = (assert!(true) as u32); }
11+
fn main() {
12+
let u = (assert!(true) as u32); //~ ERROR non-scalar cast: `()` as `u32`
13+
}

src/test/compile-fail/cast-to-nil.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,5 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: non-scalar cast: `u32` as `()`
12-
fn main() { let u = 0u32 as (); }
11+
fn main() {
12+
let u = 0u32 as (); //~ ERROR non-scalar cast: `u32` as `()`
13+
}

src/test/compile-fail/cfg-attr-cfg-2.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010
//
1111
// error-pattern: main function not found
12+
// error-pattern: aborting due to previous error
1213
// compile-flags: --cfg foo
1314

1415
// main is conditionally compiled, but the conditional compilation
+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2014-2015 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
//
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:main function not found
11+
// error-pattern: main function not found
12+
// error-pattern: aborting due to previous error
1213

1314
#![cfg(bar)]

src/test/compile-fail/const-eval-overflow-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const NEG_NEG_128: i8 = -NEG_128;
2424

2525
fn main() {
2626
match -128i8 {
27-
NEG_NEG_128 => println!("A"),
27+
NEG_NEG_128 => println!("A"), //~ NOTE in pattern here
2828
_ => println!("B"),
2929
}
3030
}

src/test/compile-fail/const-eval-overflow-3.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
// self-hosted and a cross-compiled setup; therefore resorting to
1818
// error-pattern for now.
1919

20-
// error-pattern: expected constant integer for repeat count, but attempted to add with overflow
21-
2220
#![allow(unused_imports)]
2321

2422
use std::fmt;
@@ -28,6 +26,8 @@ use std::{u8, u16, u32, u64, usize};
2826
const A_I8_I
2927
: [u32; (i8::MAX as usize) + 1]
3028
= [0; (i8::MAX + 1) as usize];
29+
//~^ ERROR expected constant integer for repeat count, but attempted to add with overflow
30+
3131

3232
fn main() {
3333
foo(&A_I8_I[..]);

src/test/compile-fail/const-eval-overflow-3b.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
// self-hosted and a cross-compiled setup; therefore resorting to
2222
// error-pattern for now.
2323

24-
// error-pattern: mismatched types
25-
2624
#![allow(unused_imports)]
2725

2826
use std::fmt;
@@ -32,6 +30,9 @@ use std::{u8, u16, u32, u64, usize};
3230
const A_I8_I
3331
: [u32; (i8::MAX as usize) + 1]
3432
= [0; (i8::MAX + 1u8) as usize];
33+
//~^ ERROR mismatched types
34+
//~| ERROR the trait `core::ops::Add<u8>` is not implemented for the type `i8`
35+
//~| ERROR the trait `core::ops::Add<u8>` is not implemented for the type `i8`
3536

3637
fn main() {
3738
foo(&A_I8_I[..]);
+4-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -8,9 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: recursive constant
1211
static a: isize = b;
12+
//~^ ERROR recursive constant
1313
static b: isize = a;
14-
15-
fn main() {
16-
}
14+
//~^ ERROR recursive constant
15+
fn main() {}

src/test/compile-fail/crateresolve1.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 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
//
@@ -11,7 +11,9 @@
1111
// aux-build:crateresolve1-1.rs
1212
// aux-build:crateresolve1-2.rs
1313
// aux-build:crateresolve1-3.rs
14-
// error-pattern:multiple matching crates for `crateresolve1`
14+
// error-pattern: multiple matching crates for `crateresolve1`
15+
// error-pattern: can't find crate for `crateresolve1`
16+
// error-pattern: aborting due to 2 previous errors
1517

1618
extern crate crateresolve1;
1719

0 commit comments

Comments
 (0)