summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-05-03 11:26:58 -0700
committerAlex Crichton <alex@alexcrichton.com>2018-05-04 15:01:28 -0700
commit6f2d023028bbd666be2c211b923b32faf10a41da (patch)
treec53c956b4e906922c9de96ec644394b5c1114815 /src/test
parenta563027cb8f2cb1c46d2a1e59f3686d3f3a3213a (diff)
downloadrust-6f2d023028bbd666be2c211b923b32faf10a41da.tar.gz
rust-6f2d023028bbd666be2c211b923b32faf10a41da.zip
Fold rustfix tests back into the UI test suite
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/suggestions/closure-immutable-outer-variable.fixed22
-rw-r--r--src/test/ui/suggestions/closure-immutable-outer-variable.nll.fixed22
-rw-r--r--src/test/ui/suggestions/closure-immutable-outer-variable.nll.stderr2
-rw-r--r--src/test/ui/suggestions/closure-immutable-outer-variable.rs2
-rw-r--r--src/test/ui/suggestions/closure-immutable-outer-variable.stderr2
-rw-r--r--src/test/ui/suggestions/issue-45562.fixed16
-rw-r--r--src/test/ui/suggestions/issue-45562.rs2
-rw-r--r--src/test/ui/suggestions/issue-45562.stderr2
-rw-r--r--src/test/ui/suggestions/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed15
-rw-r--r--src/test/ui/suggestions/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs2
-rw-r--r--src/test/ui/suggestions/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr2
-rw-r--r--src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.fixed26
-rw-r--r--src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.rs2
-rw-r--r--src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.stderr4
-rw-r--r--src/test/ui/suggestions/missing-comma-in-match.fixed21
-rw-r--r--src/test/ui/suggestions/missing-comma-in-match.rs2
-rw-r--r--src/test/ui/suggestions/missing-comma-in-match.stderr2
-rw-r--r--src/test/ui/suggestions/str-as-char.fixed16
-rw-r--r--src/test/ui/suggestions/str-as-char.rs2
-rw-r--r--src/test/ui/suggestions/str-as-char.stderr2
-rw-r--r--src/test/ui/suggestions/tuple-float-index.fixed16
-rw-r--r--src/test/ui/suggestions/tuple-float-index.rs1
-rw-r--r--src/test/ui/suggestions/tuple-float-index.stderr2
-rwxr-xr-xsrc/test/ui/update-references.sh4
24 files changed, 178 insertions, 11 deletions
diff --git a/src/test/ui/suggestions/closure-immutable-outer-variable.fixed b/src/test/ui/suggestions/closure-immutable-outer-variable.fixed
new file mode 100644
index 00000000000..b3a0d592f76
--- /dev/null
+++ b/src/test/ui/suggestions/closure-immutable-outer-variable.fixed
@@ -0,0 +1,22 @@
+// Copyright 2017 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// run-rustfix
+
+// Point at the captured immutable outer variable
+
+fn foo(mut f: Box<FnMut()>) {
+    f();
+}
+
+fn main() {
+    let mut y = true;
+    foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable
+}
diff --git a/src/test/ui/suggestions/closure-immutable-outer-variable.nll.fixed b/src/test/ui/suggestions/closure-immutable-outer-variable.nll.fixed
new file mode 100644
index 00000000000..e162678460c
--- /dev/null
+++ b/src/test/ui/suggestions/closure-immutable-outer-variable.nll.fixed
@@ -0,0 +1,22 @@
+// Copyright 2017 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// run-rustfix
+
+// Point at the captured immutable outer variable
+
+fn foo(mut f: Box<FnMut()>) {
+    f();
+}
+
+fn main() {
+    let y = true;
+    foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable
+}
diff --git a/src/test/ui/suggestions/closure-immutable-outer-variable.nll.stderr b/src/test/ui/suggestions/closure-immutable-outer-variable.nll.stderr
index e4e93ecac8e..bc655114c2b 100644
--- a/src/test/ui/suggestions/closure-immutable-outer-variable.nll.stderr
+++ b/src/test/ui/suggestions/closure-immutable-outer-variable.nll.stderr
@@ -1,5 +1,5 @@
 error[E0594]: cannot assign to immutable item `y`
-  --> $DIR/closure-immutable-outer-variable.rs:19:26
+  --> $DIR/closure-immutable-outer-variable.rs:21:26
    |
 LL |     foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable
    |                          ^^^^^^^^^ cannot mutate
diff --git a/src/test/ui/suggestions/closure-immutable-outer-variable.rs b/src/test/ui/suggestions/closure-immutable-outer-variable.rs
index 1d14afd6a01..e162678460c 100644
--- a/src/test/ui/suggestions/closure-immutable-outer-variable.rs
+++ b/src/test/ui/suggestions/closure-immutable-outer-variable.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// run-rustfix
+
 // Point at the captured immutable outer variable
 
 fn foo(mut f: Box<FnMut()>) {
diff --git a/src/test/ui/suggestions/closure-immutable-outer-variable.stderr b/src/test/ui/suggestions/closure-immutable-outer-variable.stderr
index 3353e2c7291..0ee11d8cf15 100644
--- a/src/test/ui/suggestions/closure-immutable-outer-variable.stderr
+++ b/src/test/ui/suggestions/closure-immutable-outer-variable.stderr
@@ -1,5 +1,5 @@
 error[E0594]: cannot assign to captured outer variable in an `FnMut` closure
-  --> $DIR/closure-immutable-outer-variable.rs:19:26
+  --> $DIR/closure-immutable-outer-variable.rs:21:26
    |
 LL |     let y = true;
    |         - help: consider making `y` mutable: `mut y`
diff --git a/src/test/ui/suggestions/issue-45562.fixed b/src/test/ui/suggestions/issue-45562.fixed
new file mode 100644
index 00000000000..7c01f0d1ee5
--- /dev/null
+++ b/src/test/ui/suggestions/issue-45562.fixed
@@ -0,0 +1,16 @@
+// Copyright 2018 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// run-rustfix
+
+#[no_mangle] pub static RAH: usize = 5;
+//~^ ERROR const items should never be #[no_mangle]
+
+fn main() {}
diff --git a/src/test/ui/suggestions/issue-45562.rs b/src/test/ui/suggestions/issue-45562.rs
index f493df56f94..c27d52fcdd3 100644
--- a/src/test/ui/suggestions/issue-45562.rs
+++ b/src/test/ui/suggestions/issue-45562.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// run-rustfix
+
 #[no_mangle] pub const RAH: usize = 5;
 //~^ ERROR const items should never be #[no_mangle]
 
diff --git a/src/test/ui/suggestions/issue-45562.stderr b/src/test/ui/suggestions/issue-45562.stderr
index d6960dca054..d9e624cadc7 100644
--- a/src/test/ui/suggestions/issue-45562.stderr
+++ b/src/test/ui/suggestions/issue-45562.stderr
@@ -1,5 +1,5 @@
 error: const items should never be #[no_mangle]
-  --> $DIR/issue-45562.rs:11:14
+  --> $DIR/issue-45562.rs:13:14
    |
 LL | #[no_mangle] pub const RAH: usize = 5;
    |              ---------^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/suggestions/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed b/src/test/ui/suggestions/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed
new file mode 100644
index 00000000000..e3287030408
--- /dev/null
+++ b/src/test/ui/suggestions/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed
@@ -0,0 +1,15 @@
+// Copyright 2017 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// run-rustfix
+
+extern crate std as other_std;
+fn main() {}
+//~^^ ERROR the name `std` is defined multiple times [E0259]
diff --git a/src/test/ui/suggestions/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs b/src/test/ui/suggestions/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs
index 4d75127b645..f47ea474d51 100644
--- a/src/test/ui/suggestions/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs
+++ b/src/test/ui/suggestions/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// run-rustfix
+
 extern crate std;
 fn main() {}
 //~^^ ERROR the name `std` is defined multiple times [E0259]
diff --git a/src/test/ui/suggestions/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr b/src/test/ui/suggestions/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr
index 8e2b2d845e9..ecdfec2b3bf 100644
--- a/src/test/ui/suggestions/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr
+++ b/src/test/ui/suggestions/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr
@@ -1,5 +1,5 @@
 error[E0259]: the name `std` is defined multiple times
-  --> $DIR/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs:11:1
+  --> $DIR/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs:13:1
    |
 LL | extern crate std;
    | ^^^^^^^^^^^^^^^^^ `std` reimported here
diff --git a/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.fixed b/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.fixed
new file mode 100644
index 00000000000..77171cad6e7
--- /dev/null
+++ b/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.fixed
@@ -0,0 +1,26 @@
+// Copyright 2017 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// run-rustfix
+
+#![allow(unused)]
+
+fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize {
+    and_yet + 1
+}
+
+fn main() {
+    let behold: isize = 2;
+    let with_tears: usize = 3;
+    light_flows_our_war_of_mocking_words(&(behold as usize));
+    //~^ ERROR mismatched types [E0308]
+    light_flows_our_war_of_mocking_words(&(with_tears + 4));
+    //~^ ERROR mismatched types [E0308]
+}
diff --git a/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.rs b/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.rs
index 5617c46afa9..e5ea9b5ed09 100644
--- a/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.rs
+++ b/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// run-rustfix
+
 #![allow(unused)]
 
 fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize {
diff --git a/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.stderr b/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.stderr
index e89e9dce94d..9c492751ca1 100644
--- a/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.stderr
+++ b/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:20:42
+  --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:22:42
    |
 LL |     light_flows_our_war_of_mocking_words(behold as usize);
    |                                          ^^^^^^^^^^^^^^^
@@ -11,7 +11,7 @@ LL |     light_flows_our_war_of_mocking_words(behold as usize);
               found type `usize`
 
 error[E0308]: mismatched types
-  --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:22:42
+  --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:24:42
    |
 LL |     light_flows_our_war_of_mocking_words(with_tears + 4);
    |                                          ^^^^^^^^^^^^^^
diff --git a/src/test/ui/suggestions/missing-comma-in-match.fixed b/src/test/ui/suggestions/missing-comma-in-match.fixed
new file mode 100644
index 00000000000..4832f35f42d
--- /dev/null
+++ b/src/test/ui/suggestions/missing-comma-in-match.fixed
@@ -0,0 +1,21 @@
+// Copyright 2018 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// run-rustfix
+
+fn main() {
+    match &Some(3) {
+        &None => 1,
+        &Some(2) => { 3 }
+        //~^ ERROR expected one of `,`, `.`, `?`, `}`, or an operator, found `=>`
+        //~| NOTE expected one of `,`, `.`, `?`, `}`, or an operator here
+        _ => 2
+    };
+}
diff --git a/src/test/ui/suggestions/missing-comma-in-match.rs b/src/test/ui/suggestions/missing-comma-in-match.rs
index 6f86cdea3cf..e39b20e77ea 100644
--- a/src/test/ui/suggestions/missing-comma-in-match.rs
+++ b/src/test/ui/suggestions/missing-comma-in-match.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// run-rustfix
+
 fn main() {
     match &Some(3) {
         &None => 1
diff --git a/src/test/ui/suggestions/missing-comma-in-match.stderr b/src/test/ui/suggestions/missing-comma-in-match.stderr
index b71a50b6631..77935934107 100644
--- a/src/test/ui/suggestions/missing-comma-in-match.stderr
+++ b/src/test/ui/suggestions/missing-comma-in-match.stderr
@@ -1,5 +1,5 @@
 error: expected one of `,`, `.`, `?`, `}`, or an operator, found `=>`
-  --> $DIR/missing-comma-in-match.rs:14:18
+  --> $DIR/missing-comma-in-match.rs:16:18
    |
 LL |         &None => 1
    |                   - help: missing a comma here to end this `match` arm
diff --git a/src/test/ui/suggestions/str-as-char.fixed b/src/test/ui/suggestions/str-as-char.fixed
new file mode 100644
index 00000000000..c0dad38e436
--- /dev/null
+++ b/src/test/ui/suggestions/str-as-char.fixed
@@ -0,0 +1,16 @@
+// Copyright 2017 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// run-rustfix
+
+fn main() {
+    println!("●●");
+    //~^ ERROR character literal may only contain one codepoint
+}
diff --git a/src/test/ui/suggestions/str-as-char.rs b/src/test/ui/suggestions/str-as-char.rs
index 09aca61147d..b5a5df0af7f 100644
--- a/src/test/ui/suggestions/str-as-char.rs
+++ b/src/test/ui/suggestions/str-as-char.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// run-rustfix
+
 fn main() {
     println!('●●');
     //~^ ERROR character literal may only contain one codepoint
diff --git a/src/test/ui/suggestions/str-as-char.stderr b/src/test/ui/suggestions/str-as-char.stderr
index d881becf00c..60eb182adf1 100644
--- a/src/test/ui/suggestions/str-as-char.stderr
+++ b/src/test/ui/suggestions/str-as-char.stderr
@@ -1,5 +1,5 @@
 error: character literal may only contain one codepoint
-  --> $DIR/str-as-char.rs:12:14
+  --> $DIR/str-as-char.rs:14:14
    |
 LL |     println!('●●');
    |              ^^^^
diff --git a/src/test/ui/suggestions/tuple-float-index.fixed b/src/test/ui/suggestions/tuple-float-index.fixed
new file mode 100644
index 00000000000..55bc2f77dad
--- /dev/null
+++ b/src/test/ui/suggestions/tuple-float-index.fixed
@@ -0,0 +1,16 @@
+// Copyright 2012 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// run-rustfix
+// compile-flags: -Z parse-only
+
+fn main () {
+    ((1, (2, 3)).1).1; //~ ERROR unexpected token: `1.1`
+}
diff --git a/src/test/ui/suggestions/tuple-float-index.rs b/src/test/ui/suggestions/tuple-float-index.rs
index 0a188305a92..d569ca4cb86 100644
--- a/src/test/ui/suggestions/tuple-float-index.rs
+++ b/src/test/ui/suggestions/tuple-float-index.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// run-rustfix
 // compile-flags: -Z parse-only
 
 fn main () {
diff --git a/src/test/ui/suggestions/tuple-float-index.stderr b/src/test/ui/suggestions/tuple-float-index.stderr
index 4a1e34890f4..15af0834f03 100644
--- a/src/test/ui/suggestions/tuple-float-index.stderr
+++ b/src/test/ui/suggestions/tuple-float-index.stderr
@@ -1,5 +1,5 @@
 error: unexpected token: `1.1`
-  --> $DIR/tuple-float-index.rs:14:17
+  --> $DIR/tuple-float-index.rs:15:17
    |
 LL |     (1, (2, 3)).1.1; //~ ERROR unexpected token: `1.1`
    |     ------------^^^
diff --git a/src/test/ui/update-references.sh b/src/test/ui/update-references.sh
index 4fc11daaa3a..47a85352b00 100755
--- a/src/test/ui/update-references.sh
+++ b/src/test/ui/update-references.sh
@@ -26,7 +26,6 @@ if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" == "" ]]; then
     echo "   $0 ../../../build/x86_64-apple-darwin/test/ui *.rs */*.rs"
 fi
 
-MYDIR=$(dirname $0)
 
 BUILD_DIR="$1"
 shift
@@ -34,7 +33,8 @@ shift
 shopt -s nullglob
 
 while [[ "$1" != "" ]]; do
-    for EXT in "stderr" "stdout"; do
+    MYDIR=$(dirname $1)
+    for EXT in "stderr" "stdout" "fixed"; do
         for OUT_NAME in $BUILD_DIR/${1%.rs}.*$EXT; do
             OUT_BASE=`basename "$OUT_NAME"`
             if ! (diff $OUT_NAME $MYDIR/$OUT_BASE >& /dev/null); then