Skip to content

Move compile-fail tests with NOTE/HELP annotations to UI #46641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions src/test/COMPILER_TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,15 @@ Sometimes these built-in normalizations are not enough. In such cases, you
may provide custom normalization rules using the header commands, e.g.

```
// normalize-stderr-32bit: "fn() (32 bits)" -> "fn() ($PTR bits)"
// normalize-stderr-64bit: "fn() (64 bits)" -> "fn() ($PTR bits)"
// normalize-stdout-test: "foo" -> "bar"
// normalize-stderr-32bit: "fn\(\) \(32 bits\)" -> "fn\(\) \($$PTR bits\)"
// normalize-stderr-64bit: "fn\(\) \(64 bits\)" -> "fn\(\) \($$PTR bits\)"
```

This tells the test, on 32-bit platforms, whenever the compiler writes
`fn() (32 bits)` to stderr, it should be normalized to read `fn() ($PTR bits)`
instead. Similar for 64-bit.
instead. Similar for 64-bit. The replacement is performed by regexes using
default regex flavor provided by `regex` crate.

The corresponding reference file will use the normalized output to test both
32-bit and 64-bit platforms:
Expand All @@ -156,4 +158,5 @@ Please see `ui/transmute/main.rs` and `.stderr` for a concrete usage example.

Besides `normalize-stderr-32bit` and `-64bit`, one may use any target
information or stage supported by `ignore-X` here as well (e.g.
`normalize-stderr-windows`).
`normalize-stderr-windows` or simply `normalize-stderr-test` for unconditional
replacement).
1 change: 0 additions & 1 deletion src/test/compile-fail/E0005.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@
fn main() {
let x = Some(1);
let Some(y) = x; //~ ERROR E0005
//~| NOTE pattern `None` not covered
}
2 changes: 0 additions & 2 deletions src/test/compile-fail/E0007.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ fn main() {
match x {
op_string @ Some(s) => {},
//~^ ERROR E0007
//~| NOTE binds an already bound by-move value by moving it
//~| ERROR E0303
//~| NOTE not allowed after `@`
None => {},
}
}
1 change: 0 additions & 1 deletion src/test/compile-fail/E0008.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ fn main() {
match Some("hi".to_string()) {
Some(s) if s.len() == 0 => {},
//~^ ERROR E0008
//~| NOTE moves value into pattern guard
_ => {},
}
}
2 changes: 0 additions & 2 deletions src/test/compile-fail/E0009.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ fn main() {
match x {
Some((y, ref z)) => {},
//~^ ERROR E0009
//~| NOTE by-move pattern here
//~| NOTE both by-ref and by-move used
None => panic!()
}
}
1 change: 0 additions & 1 deletion src/test/compile-fail/E0010.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@
#![allow(warnings)]

const CON : Box<i32> = box 0; //~ ERROR E0010
//~| NOTE allocation not allowed in

fn main() {}
3 changes: 0 additions & 3 deletions src/test/compile-fail/E0017.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ static X: i32 = 1;
const C: i32 = 2;

const CR: &'static mut i32 = &mut C; //~ ERROR E0017
//~| NOTE constants require immutable values
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
//~| NOTE statics require immutable values
//~| ERROR cannot borrow
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
//~| NOTE statics require immutable values
fn main() {}
3 changes: 0 additions & 3 deletions src/test/compile-fail/E0023.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ fn main() {
let x = Fruit::Apple(String::new(), String::new());
match x {
Fruit::Apple(a) => {}, //~ ERROR E0023
//~| NOTE expected 2 fields, found 1
Fruit::Apple(a, b, c) => {}, //~ ERROR E0023
//~| NOTE expected 2 fields, found 3
Fruit::Pear(1, 2) => {}, //~ ERROR E0023
//~| NOTE expected 1 field, found 2
}
}
2 changes: 0 additions & 2 deletions src/test/compile-fail/E0025.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@ fn main() {
let x = Foo { a:1, b:2 };
let Foo { a: x, a: y, b: 0 } = x;
//~^ ERROR field `a` bound multiple times in the pattern
//~| NOTE multiple uses of `a` in pattern
//~| NOTE first use of `a`
}
1 change: 0 additions & 1 deletion src/test/compile-fail/E0026.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ fn main() {
match thing {
Thing { x, y, z } => {}
//~^ ERROR struct `Thing` does not have a field named `z` [E0026]
//~| NOTE struct `Thing` does not have field `z`
}
}
1 change: 0 additions & 1 deletion src/test/compile-fail/E0027.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ fn main() {
match d {
Dog { age: x } => {}
//~^ ERROR pattern does not mention field `name`
//~| NOTE missing field `name`
}
}
3 changes: 0 additions & 3 deletions src/test/compile-fail/E0029.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ fn main() {
match s {
"hello" ... "world" => {}
//~^ ERROR only char and numeric types are allowed in range patterns
//~| NOTE ranges require char or numeric types
//~| NOTE start type: &'static str
//~| NOTE end type: &'static str
//~| ERROR non-reference pattern used to match a reference
_ => {}
}
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/E0030.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ fn main() {
match 5u32 {
1000 ... 5 => {}
//~^ ERROR lower range bound must be less than or equal to upper
//~| NOTE lower bound larger than upper bound
}
}
3 changes: 0 additions & 3 deletions src/test/compile-fail/E0033.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ trait SomeTrait {
fn main() {
let trait_obj: &SomeTrait = SomeTrait;
//~^ ERROR expected value, found trait `SomeTrait`
//~| NOTE not a value
//~| ERROR E0038
//~| method `foo` has no receiver
//~| NOTE the trait `SomeTrait` cannot be made into an object

let &invalid = trait_obj;
//~^ ERROR E0033
//~| NOTE type `&SomeTrait` cannot be dereferenced
}
3 changes: 0 additions & 3 deletions src/test/compile-fail/E0034.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ trait Trait2 {

impl Trait1 for Test {
fn foo() {}
//~^ NOTE candidate #1 is defined in an impl of the trait `Trait1` for the type `Test`
}

impl Trait2 for Test {
fn foo() {}
//~^ NOTE candidate #2 is defined in an impl of the trait `Trait2` for the type `Test`
}

fn main() {
Test::foo() //~ ERROR multiple applicable items in scope
//~| NOTE multiple `foo` found
}
2 changes: 0 additions & 2 deletions src/test/compile-fail/E0038.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ trait Trait {

fn call_foo(x: Box<Trait>) {
//~^ ERROR E0038
//~| NOTE the trait `Trait` cannot be made into an object
//~| NOTE method `foo` references the `Self` type in its arguments or return type
let y = x.foo();
}

Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/E0040.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ fn main() {
let mut x = Foo { x: -7 };
x.drop();
//~^ ERROR E0040
//~| NOTE explicit destructor calls not allowed
}
1 change: 0 additions & 1 deletion src/test/compile-fail/E0045.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

extern "Rust" { fn foo(x: u8, ...); } //~ ERROR E0045
//~| NOTE variadics require C or cdecl calling convention

fn main() {
}
3 changes: 1 addition & 2 deletions src/test/compile-fail/E0049.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
// except according to those terms.

trait Foo {
fn foo<T: Default>(x: T) -> Self; //~ NOTE expected 1 type parameter
fn foo<T: Default>(x: T) -> Self;
}

struct Bar;

impl Foo for Bar {
fn foo(x: bool) -> Self { Bar } //~ ERROR E0049
//~| NOTE found 0 type parameters
}

fn main() {
Expand Down
9 changes: 3 additions & 6 deletions src/test/compile-fail/E0050.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@
// except according to those terms.

trait Foo {
fn foo(&self, x: u8) -> bool; //~ NOTE trait requires 2 parameters
fn bar(&self, x: u8, y: u8, z: u8); //~ NOTE trait requires 4 parameters
fn less(&self); //~ NOTE trait requires 1 parameter
fn foo(&self, x: u8) -> bool;
fn bar(&self, x: u8, y: u8, z: u8);
fn less(&self);
}

struct Bar;

impl Foo for Bar {
fn foo(&self) -> bool { true } //~ ERROR E0050
//~| NOTE expected 2 parameters, found 1
fn bar(&self) { } //~ ERROR E0050
//~| NOTE expected 4 parameters, found 1
fn less(&self, x: u8, y: u8, z: u8) { } //~ ERROR E0050
//~| NOTE expected 1 parameter, found 4
}

fn main() {
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/E0055.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ fn main() {
let ref_foo = &&Foo;
ref_foo.foo();
//~^ ERROR E0055
//~| NOTE deref recursion limit reached
}
1 change: 0 additions & 1 deletion src/test/compile-fail/E0060.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

extern "C" {
fn printf(_: *const u8, ...) -> u32;
//~^ NOTE defined here
}

fn main() {
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/E0061.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
// except according to those terms.

fn f(a: u16, b: &str) {}
//~^ NOTE defined here

fn f2(a: u16) {}
//~^ NOTE defined here

fn main() {
f(0);
Expand Down
3 changes: 1 addition & 2 deletions src/test/compile-fail/E0062.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ struct Foo {

fn main() {
let x = Foo {
x: 0, //~ NOTE first use of `x`
x: 0,
x: 0,
//~^ ERROR E0062
//~| NOTE used more than once
};
}
4 changes: 0 additions & 4 deletions src/test/compile-fail/E0063.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,10 @@ struct TruncatedPluralFoo {
fn main() {
let w = SingleFoo { };
//~^ ERROR missing field `x` in initializer of `SingleFoo`
//~| NOTE missing `x`
let x = PluralFoo {x: 1};
//~^ ERROR missing fields `y`, `z` in initializer of `PluralFoo`
//~| NOTE missing `y`, `z`
let y = TruncatedFoo{x:1};
//~^ missing fields `a`, `b`, `y` and 1 other field in initializer of `TruncatedFoo`
//~| NOTE `a`, `b`, `y` and 1 other field
let z = TruncatedPluralFoo{x:1};
//~^ ERROR missing fields `a`, `b`, `c` and 2 other fields in initializer of `TruncatedPluralFoo`
//~| NOTE missing `a`, `b`, `c` and 2 other fields
}
2 changes: 0 additions & 2 deletions src/test/compile-fail/E0067.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@ use std::collections::LinkedList;
fn main() {
LinkedList::new() += 1; //~ ERROR E0368
//~^ ERROR E0067
//~^^ NOTE invalid expression for left-hand side
//~| NOTE cannot use `+=` on type `std::collections::LinkedList<_>`
}
1 change: 0 additions & 1 deletion src/test/compile-fail/E0069.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
fn foo() -> u8 {
return;
//~^ ERROR `return;` in a function whose return type is not `()`
//~| NOTE return type is not ()
}

fn main() {
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/E0071.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ type FooAlias = Foo;
fn main() {
let u = FooAlias { value: 0 };
//~^ ERROR expected struct, variant or union type, found enum `Foo` [E0071]
//~| NOTE not a struct
}
1 change: 0 additions & 1 deletion src/test/compile-fail/E0076.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#[repr(simd)]
struct Bad(u16, u32, u32);
//~^ ERROR E0076
//~| NOTE SIMD elements must have the same type

fn main() {
}
3 changes: 1 addition & 2 deletions src/test/compile-fail/E0081.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
// except according to those terms.

enum Enum {
P = 3, //~ NOTE first use of `3isize`
P = 3,
X = 3,
//~^ ERROR discriminant value `3isize` already exists
//~| NOTE enum already has `3isize`
Y = 5
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/E0084.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

#[repr(i32)] //~ ERROR: E0084
enum Foo {} //~ NOTE: zero-variant enum
enum Foo {}

fn main() {
}
2 changes: 0 additions & 2 deletions src/test/compile-fail/E0087.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ fn bar<T>() {}

fn main() {
foo::<f64>(); //~ ERROR expected at most 0 type parameters, found 1 type parameter [E0087]
//~^ NOTE expected 0 type parameters

bar::<f64, u64>(); //~ ERROR expected at most 1 type parameter, found 2 type parameters [E0087]
//~^ NOTE expected 1 type parameter
}
1 change: 0 additions & 1 deletion src/test/compile-fail/E0089.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ fn foo<T, U>() {}

fn main() {
foo::<f64>(); //~ ERROR expected 2 type parameters, found 1 type parameter [E0089]
//~| NOTE expected 2 type parameters
}
1 change: 0 additions & 1 deletion src/test/compile-fail/E0090.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ fn foo<'a: 'b, 'b: 'a>() {}

fn main() {
foo::<'static>(); //~ ERROR expected 2 lifetime parameters, found 1 lifetime parameter [E0090]
//~^ NOTE expected 2 lifetime parameters
}
2 changes: 0 additions & 2 deletions src/test/compile-fail/E0091.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
// except according to those terms.

type Foo<T> = u32; //~ ERROR E0091
//~| NOTE unused type parameter
type Foo2<A, B> = Box<A>; //~ ERROR E0091
//~| NOTE unused type parameter

fn main() {
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/E0092.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#![feature(intrinsics)]
extern "rust-intrinsic" {
fn atomic_foo(); //~ ERROR E0092
} //~| NOTE unrecognized atomic operation
}

fn main() {
}
1 change: 0 additions & 1 deletion src/test/compile-fail/E0093.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
extern "rust-intrinsic" {
fn foo();
//~^ ERROR E0093
//~| NOTE unrecognized intrinsic
}

fn main() {
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/E0094.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#![feature(intrinsics)]
extern "rust-intrinsic" {
fn size_of<T, U>() -> usize; //~ ERROR E0094
//~| NOTE expected 1 type parameter
}

fn main() {
Expand Down
Loading