diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2017-12-12 23:46:33 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2017-12-14 23:54:08 +0300 |
| commit | 66bd53ad2acb3b001ba31ff2ba1c32491bd8489b (patch) | |
| tree | e199fcaff9ac96321c72c6c208a497dac6688c5b | |
| parent | c3a7d36c6e2da097f705525fc6bf7726360601f5 (diff) | |
| download | rust-66bd53ad2acb3b001ba31ff2ba1c32491bd8489b.tar.gz rust-66bd53ad2acb3b001ba31ff2ba1c32491bd8489b.zip | |
Fix rebase
Update docs for custom normalization of test output
19 files changed, 103 insertions, 67 deletions
diff --git a/src/test/COMPILER_TESTS.md b/src/test/COMPILER_TESTS.md index 0bc29e8b5aa..021f27dacbe 100644 --- a/src/test/COMPILER_TESTS.md +++ b/src/test/COMPILER_TESTS.md @@ -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: @@ -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). diff --git a/src/test/ui/issue-17954.rs b/src/test/compile-fail/issue-17954.rs index 4211057610b..4211057610b 100644 --- a/src/test/ui/issue-17954.rs +++ b/src/test/compile-fail/issue-17954.rs diff --git a/src/test/ui/const-eval-overflow-4.stderr b/src/test/ui/const-eval-overflow-4.stderr index d35b9c6c571..98c6ae1b9bc 100644 --- a/src/test/ui/const-eval-overflow-4.stderr +++ b/src/test/ui/const-eval-overflow-4.stderr @@ -1,3 +1,11 @@ +warning: constant evaluation error: attempt to add with overflow + --> $DIR/const-eval-overflow-4.rs:23:13 + | +23 | : [u32; (i8::MAX as i8 + 1i8) as usize] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(const_err)] on by default + error[E0080]: constant evaluation error --> $DIR/const-eval-overflow-4.rs:23:13 | diff --git a/src/test/ui/const-fn-error.stderr b/src/test/ui/const-fn-error.stderr index f86b94a4c74..0e275e78fc6 100644 --- a/src/test/ui/const-fn-error.stderr +++ b/src/test/ui/const-fn-error.stderr @@ -1,14 +1,46 @@ +warning: constant evaluation error: non-constant path in constant expression + --> $DIR/const-fn-error.rs:27:19 + | +27 | let a : [i32; f(X)]; + | ^^^^ + | + = note: #[warn(const_err)] on by default + +error[E0016]: blocks in constant functions are limited to items and tail expressions + --> $DIR/const-fn-error.rs:16:19 + | +16 | let mut sum = 0; //~ ERROR blocks in constant functions are limited + | ^ + +error[E0015]: calls in constant functions are limited to constant functions, struct and enum constructors + --> $DIR/const-fn-error.rs:17:5 + | +17 | / for i in 0..x { //~ ERROR calls in constant functions +18 | | //~| ERROR constant function contains unimplemented +19 | | sum += i; +20 | | } + | |_____^ + +error[E0019]: constant function contains unimplemented expression type + --> $DIR/const-fn-error.rs:17:5 + | +17 | / for i in 0..x { //~ ERROR calls in constant functions +18 | | //~| ERROR constant function contains unimplemented +19 | | sum += i; +20 | | } + | |_____^ + error[E0080]: constant evaluation error - --> $DIR/const-fn-error.rs:20:5 + --> $DIR/const-fn-error.rs:21:5 | -20 | sum //~ ERROR E0080 +21 | sum //~ ERROR E0080 | ^^^ non-constant path in constant expression | note: for constant expression here - --> $DIR/const-fn-error.rs:26:13 + --> $DIR/const-fn-error.rs:27:13 | -26 | let a : [i32; f(X)]; +27 | let a : [i32; f(X)]; | ^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 4 previous errors diff --git a/src/test/ui/const-len-underflow-separate-spans.rs b/src/test/ui/const-len-underflow-separate-spans.rs index 0fd49bec159..823cc988947 100644 --- a/src/test/ui/const-len-underflow-separate-spans.rs +++ b/src/test/ui/const-len-underflow-separate-spans.rs @@ -15,10 +15,8 @@ const ONE: usize = 1; const TWO: usize = 2; const LEN: usize = ONE - TWO; -//~^ ERROR E0080 -//~| attempt to subtract with overflow -//~| NOTE attempt to subtract with overflow -//~| NOTE on by default +//~^ ERROR constant evaluation error [E0080] +//~| WARN attempt to subtract with overflow fn main() { let a: [i8; LEN] = unimplemented!(); diff --git a/src/test/ui/const-len-underflow-separate-spans.stderr b/src/test/ui/const-len-underflow-separate-spans.stderr index 1c45d37f489..6e6c2130e1c 100644 --- a/src/test/ui/const-len-underflow-separate-spans.stderr +++ b/src/test/ui/const-len-underflow-separate-spans.stderr @@ -1,3 +1,11 @@ +warning: constant evaluation error: attempt to subtract with overflow + --> $DIR/const-len-underflow-separate-spans.rs:17:20 + | +17 | const LEN: usize = ONE - TWO; + | ^^^^^^^^^ + | + = note: #[warn(const_err)] on by default + error[E0080]: constant evaluation error --> $DIR/const-len-underflow-separate-spans.rs:17:20 | diff --git a/src/test/ui/issue-17954.stderr b/src/test/ui/issue-17954.stderr deleted file mode 100644 index 2ee4a66882b..00000000000 --- a/src/test/ui/issue-17954.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0597]: borrowed value does not live long enough - --> $DIR/issue-17954.rs:17:14 - | -17 | let a = &FOO; - | ^^^ does not live long enough -... -24 | } //~ temporary value only lives until here - | - temporary value only lives until here - | - = note: borrowed value must be valid for the static lifetime... - -error: aborting due to previous error - diff --git a/src/test/ui/issue-18819.stderr b/src/test/ui/issue-18819.stderr index 25623668e37..1cd899925ca 100644 --- a/src/test/ui/issue-18819.stderr +++ b/src/test/ui/issue-18819.stderr @@ -1,13 +1,11 @@ error[E0061]: this function takes 2 parameters but 1 parameter was supplied - --> $DIR/issue-18819.rs:26:13 + --> $DIR/issue-18819.rs:26:5 | -21 | / fn print_x(_: &Foo<Item=bool>, extra: &str) { -22 | | println!("{}", extra); -23 | | } - | |_- defined here +21 | fn print_x(_: &Foo<Item=bool>, extra: &str) { + | ------------------------------------------- defined here ... -26 | print_x(X); - | ^ expected 2 parameters +26 | print_x(X); + | ^^^^^^^^^^ expected 2 parameters error: aborting due to previous error diff --git a/src/test/ui/issue-30255.rs b/src/test/ui/issue-30255.rs index 7db0b1ca203..64f70ef2b6f 100644 --- a/src/test/ui/issue-30255.rs +++ b/src/test/ui/issue-30255.rs @@ -30,3 +30,4 @@ fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 { panic!(); } +fn main() {} diff --git a/src/test/ui/issue-3044.stderr b/src/test/ui/issue-3044.stderr index 3fede94c115..14f2d5195d6 100644 --- a/src/test/ui/issue-3044.stderr +++ b/src/test/ui/issue-3044.stderr @@ -1,10 +1,8 @@ error[E0061]: this function takes 2 parameters but 1 parameter was supplied - --> $DIR/issue-3044.rs:14:28 + --> $DIR/issue-3044.rs:14:23 | -14 | needlesArr.iter().fold(|x, y| { - | ____________________________^ -15 | | }); - | |_____^ expected 2 parameters +14 | needlesArr.iter().fold(|x, y| { + | ^^^^ expected 2 parameters error: aborting due to previous error diff --git a/src/test/ui/issue-4935.stderr b/src/test/ui/issue-4935.stderr index 8859ab8550b..654fe53c07f 100644 --- a/src/test/ui/issue-4935.stderr +++ b/src/test/ui/issue-4935.stderr @@ -1,11 +1,11 @@ error[E0061]: this function takes 1 parameter but 2 parameters were supplied - --> $DIR/issue-4935.rs:15:17 + --> $DIR/issue-4935.rs:15:13 | 13 | fn foo(a: usize) {} - | ------------------- defined here + | ---------------- defined here 14 | //~^ defined here 15 | fn main() { foo(5, 6) } - | ^^^^ expected 1 parameter + | ^^^^^^^^^ expected 1 parameter error: aborting due to previous error diff --git a/src/test/ui/method-call-err-msg.stderr b/src/test/ui/method-call-err-msg.stderr index 59a94ae144c..8685d0fc9c1 100644 --- a/src/test/ui/method-call-err-msg.stderr +++ b/src/test/ui/method-call-err-msg.stderr @@ -1,28 +1,28 @@ error[E0061]: this function takes 0 parameters but 1 parameter was supplied - --> $DIR/method-call-err-msg.rs:25:7 + --> $DIR/method-call-err-msg.rs:22:7 | 15 | fn zero(self) -> Foo { self } | -------------------- defined here ... -25 | x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter was supplied +22 | x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter was supplied | ^^^^ expected 0 parameters error[E0061]: this function takes 1 parameter but 0 parameters were supplied --> $DIR/method-call-err-msg.rs:23:7 | -17 | fn one(self, _: isize) -> Foo { self } +16 | fn one(self, _: isize) -> Foo { self } | ----------------------------- defined here ... 23 | .one() //~ ERROR this function takes 1 parameter but 0 parameters were supplied | ^^^ expected 1 parameter error[E0061]: this function takes 2 parameters but 1 parameter was supplied - --> $DIR/method-call-err-msg.rs:29:7 + --> $DIR/method-call-err-msg.rs:24:7 | -19 | fn two(self, _: isize, _: isize) -> Foo { self } +17 | fn two(self, _: isize, _: isize) -> Foo { self } | --------------------------------------- defined here ... -29 | .two(0); //~ ERROR this function takes 2 parameters but 1 parameter was supplied +24 | .two(0); //~ ERROR this function takes 2 parameters but 1 parameter was supplied | ^^^ expected 2 parameters error[E0599]: no method named `take` found for type `Foo` in the current scope diff --git a/src/test/ui/mismatched_types/fn-variance-1.rs b/src/test/ui/mismatched_types/fn-variance-1.rs index de4278e3a03..2b797ef7681 100644 --- a/src/test/ui/mismatched_types/fn-variance-1.rs +++ b/src/test/ui/mismatched_types/fn-variance-1.rs @@ -9,10 +9,8 @@ // except according to those terms. fn takes_imm(x: &isize) { } -//~^ NOTE found signature fn takes_mut(x: &mut isize) { } -//~^ NOTE found signature fn apply<T, F>(t: T, f: F) where F: FnOnce(T) { f(t) diff --git a/src/test/ui/mismatched_types/fn-variance-1.stderr b/src/test/ui/mismatched_types/fn-variance-1.stderr index 856efcd4218..2a27ffd1062 100644 --- a/src/test/ui/mismatched_types/fn-variance-1.stderr +++ b/src/test/ui/mismatched_types/fn-variance-1.stderr @@ -1,21 +1,21 @@ error[E0631]: type mismatch in function arguments - --> $DIR/fn-variance-1.rs:23:5 + --> $DIR/fn-variance-1.rs:21:5 | -14 | fn takes_mut(x: &mut isize) { } +13 | fn takes_mut(x: &mut isize) { } | --------------------------- found signature of `for<'r> fn(&'r mut isize) -> _` ... -23 | apply(&3, takes_mut); +21 | apply(&3, takes_mut); | ^^^^^ expected signature of `fn(&{integer}) -> _` | = note: required by `apply` error[E0631]: type mismatch in function arguments - --> $DIR/fn-variance-1.rs:29:5 + --> $DIR/fn-variance-1.rs:25:5 | 11 | fn takes_imm(x: &isize) { } | ----------------------- found signature of `for<'r> fn(&'r isize) -> _` ... -29 | apply(&mut 3, takes_imm); +25 | apply(&mut 3, takes_imm); | ^^^^^ expected signature of `fn(&mut {integer}) -> _` | = note: required by `apply` diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr index 2122e810046..1d4adc7d6d5 100644 --- a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr @@ -14,9 +14,9 @@ error[E0057]: this function takes 1 parameter but 0 parameters were supplied | ^^^ expected 1 parameter error[E0057]: this function takes 1 parameter but 2 parameters were supplied - --> $DIR/overloaded-calls-bad.rs:44:15 + --> $DIR/overloaded-calls-bad.rs:41:15 | -44 | let ans = s("burma", "shave"); +41 | let ans = s("burma", "shave"); | ^^^^^^^^^^^^^^^^^^^ expected 1 parameter error: aborting due to 3 previous errors diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr index 4964a81f4d2..8539c8818c0 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -3,8 +3,7 @@ error[E0631]: type mismatch in closure arguments | 22 | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); | ----------------------------- found signature of `fn(usize, isize) -> _` -23 | //~^ NOTE found signature of `fn(usize, isize) -24 | let z = call_it(3, f); +23 | let z = call_it(3, f); | ^^^^^^^ expected signature of `fn(isize, isize) -> _` | = note: required by `call_it` diff --git a/src/test/ui/not-enough-arguments.stderr b/src/test/ui/not-enough-arguments.stderr index e92175c09d7..291aa6ec4c1 100644 --- a/src/test/ui/not-enough-arguments.stderr +++ b/src/test/ui/not-enough-arguments.stderr @@ -1,13 +1,11 @@ error[E0061]: this function takes 4 parameters but 3 parameters were supplied - --> $DIR/not-enough-arguments.rs:20:7 + --> $DIR/not-enough-arguments.rs:20:3 | -15 | / fn foo(a: isize, b: isize, c: isize, d:isize) { -16 | | panic!(); -17 | | } - | |_- defined here +15 | fn foo(a: isize, b: isize, c: isize, d:isize) { + | --------------------------------------------- defined here ... -20 | foo(1, 2, 3); - | ^^^^^^^ expected 4 parameters +20 | foo(1, 2, 3); + | ^^^^^^^^^^^^ expected 4 parameters error: aborting due to previous error diff --git a/src/test/ui/union/union-const-eval.stderr b/src/test/ui/union/union-const-eval.stderr index e61a9d390cc..3c98b5cdc6c 100644 --- a/src/test/ui/union/union-const-eval.stderr +++ b/src/test/ui/union/union-const-eval.stderr @@ -1,3 +1,11 @@ +warning: constant evaluation error: nonexistent struct field + --> $DIR/union-const-eval.rs:21:21 + | +21 | let b: [u8; C.b]; //~ ERROR constant evaluation error + | ^^^ + | + = note: #[warn(const_err)] on by default + error[E0080]: constant evaluation error --> $DIR/union-const-eval.rs:21:21 | diff --git a/src/test/ui/variadic-ffi-3.stderr b/src/test/ui/variadic-ffi-3.stderr index 44660d853f2..be158c1e398 100644 --- a/src/test/ui/variadic-ffi-3.stderr +++ b/src/test/ui/variadic-ffi-3.stderr @@ -8,13 +8,13 @@ error[E0060]: this function takes at least 2 parameters but 0 parameters were su | ^^^^^ expected at least 2 parameters error[E0060]: this function takes at least 2 parameters but 1 parameter was supplied - --> $DIR/variadic-ffi-3.rs:22:13 + --> $DIR/variadic-ffi-3.rs:22:9 | 12 | fn foo(f: isize, x: u8, ...); | ----------------------------- defined here ... 22 | foo(1); //~ ERROR: this function takes at least 2 parameters but 1 parameter was supplied - | ^ expected at least 2 parameters + | ^^^^^^ expected at least 2 parameters error[E0308]: mismatched types --> $DIR/variadic-ffi-3.rs:24:56 |
