about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2017-05-16 15:11:34 +0200
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2017-07-17 08:38:54 +0200
commit4a286639e8448476b0235c8fb2c8eeb7779b9251 (patch)
tree847a401037fdfbd355100f141fe8dc5e3f7faf6c
parent08652ec95721ea66facfda4626dd1ec543434ade (diff)
downloadrust-4a286639e8448476b0235c8fb2c8eeb7779b9251.tar.gz
rust-4a286639e8448476b0235c8fb2c8eeb7779b9251.zip
Move some tests from compile-fail to ui
-rw-r--r--src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs23
-rw-r--r--src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs23
-rw-r--r--src/test/ui-fulldeps/auxiliary/derive-clona.rs23
-rw-r--r--src/test/ui-fulldeps/auxiliary/derive-foo.rs23
-rw-r--r--src/test/ui-fulldeps/resolve-error.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/resolve-error.rs)17
-rw-r--r--src/test/ui-fulldeps/resolve-error.stderr76
-rw-r--r--src/test/ui/cast-to-unsized-trait-object-suggestion.rs (renamed from src/test/compile-fail/cast-to-unsized-trait-object-suggestion.rs)6
-rw-r--r--src/test/ui/cast-to-unsized-trait-object-suggestion.stderr18
-rw-r--r--src/test/ui/issue-35675.rs (renamed from src/test/compile-fail/issue-35675.rs)0
-rw-r--r--src/test/ui/issue-35675.stderr74
-rw-r--r--src/test/ui/macros/macro-name-typo.rs (renamed from src/test/compile-fail/macro-name-typo.rs)2
-rw-r--r--src/test/ui/macros/macro-name-typo.stderr10
-rw-r--r--src/test/ui/macros/macro_undefined.rs (renamed from src/test/compile-fail/macro_undefined.rs)4
-rw-r--r--src/test/ui/macros/macro_undefined.stderr18
-rw-r--r--src/test/ui/resolve-error.stderr76
15 files changed, 364 insertions, 29 deletions
diff --git a/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs b/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs
new file mode 100644
index 00000000000..db0c19e96f8
--- /dev/null
+++ b/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs
@@ -0,0 +1,23 @@
+// Copyright 2016 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.
+
+// force-host
+// no-prefer-dynamic
+#![feature(proc_macro)]
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_attribute]
+pub fn attr_proc_macro(_: TokenStream, input: TokenStream) -> TokenStream {
+    input
+}
diff --git a/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs b/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs
new file mode 100644
index 00000000000..89ac11b309d
--- /dev/null
+++ b/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs
@@ -0,0 +1,23 @@
+// Copyright 2016 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.
+
+// force-host
+// no-prefer-dynamic
+#![feature(proc_macro)]
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro]
+pub fn bang_proc_macro(input: TokenStream) -> TokenStream {
+    input
+}
diff --git a/src/test/ui-fulldeps/auxiliary/derive-clona.rs b/src/test/ui-fulldeps/auxiliary/derive-clona.rs
new file mode 100644
index 00000000000..719fbdb15ef
--- /dev/null
+++ b/src/test/ui-fulldeps/auxiliary/derive-clona.rs
@@ -0,0 +1,23 @@
+// Copyright 2016 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(Clona)]
+pub fn derive_clonea(input: TokenStream) -> TokenStream {
+    "".parse().unwrap()
+}
diff --git a/src/test/ui-fulldeps/auxiliary/derive-foo.rs b/src/test/ui-fulldeps/auxiliary/derive-foo.rs
new file mode 100644
index 00000000000..64dcf72ba20
--- /dev/null
+++ b/src/test/ui-fulldeps/auxiliary/derive-foo.rs
@@ -0,0 +1,23 @@
+// Copyright 2016 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(FooWithLongName)]
+pub fn derive_foo(input: TokenStream) -> TokenStream {
+    "".parse().unwrap()
+}
diff --git a/src/test/compile-fail-fulldeps/proc-macro/resolve-error.rs b/src/test/ui-fulldeps/resolve-error.rs
index ddd8631f02e..dfaa1d7a32e 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/resolve-error.rs
+++ b/src/test/ui-fulldeps/resolve-error.rs
@@ -35,46 +35,29 @@ macro_rules! attr_proc_mac {
 }
 
 #[derive(FooWithLongNan)]
-//~^ ERROR cannot find derive macro `FooWithLongNan` in this scope
-//~^^ HELP did you mean `FooWithLongName`?
 struct Foo;
 
 #[attr_proc_macra]
-//~^ ERROR cannot find attribute macro `attr_proc_macra` in this scope
-//~^^ HELP did you mean `attr_proc_macro`?
 struct Bar;
 
 #[FooWithLongNan]
-//~^ ERROR cannot find attribute macro `FooWithLongNan` in this scope
 struct Asdf;
 
 #[derive(Dlone)]
-//~^ ERROR cannot find derive macro `Dlone` in this scope
-//~^^ HELP did you mean `Clone`?
 struct A;
 
 #[derive(Dlona)]
-//~^ ERROR cannot find derive macro `Dlona` in this scope
-//~^^ HELP did you mean `Clona`?
 struct B;
 
 #[derive(attr_proc_macra)]
-//~^ ERROR cannot find derive macro `attr_proc_macra` in this scope
 struct C;
 
 fn main() {
     FooWithLongNama!();
-    //~^ ERROR cannot find macro `FooWithLongNama!` in this scope
-    //~^^ HELP did you mean `FooWithLongNam!`?
 
     attr_proc_macra!();
-    //~^ ERROR cannot find macro `attr_proc_macra!` in this scope
-    //~^^ HELP did you mean `attr_proc_mac!`?
 
     Dlona!();
-    //~^ ERROR cannot find macro `Dlona!` in this scope
 
     bang_proc_macrp!();
-    //~^ ERROR cannot find macro `bang_proc_macrp!` in this scope
-    //~^^ HELP did you mean `bang_proc_macro!`?
 }
diff --git a/src/test/ui-fulldeps/resolve-error.stderr b/src/test/ui-fulldeps/resolve-error.stderr
new file mode 100644
index 00000000000..cfc15d69feb
--- /dev/null
+++ b/src/test/ui-fulldeps/resolve-error.stderr
@@ -0,0 +1,76 @@
+error: cannot find derive macro `FooWithLongNan` in this scope
+  --> $DIR/resolve-error.rs:36:10
+   |
+36 | #[derive(FooWithLongNan)]
+   |          ^^^^^^^^^^^^^^
+   |
+   = help: did you mean `FooWithLongName`?
+
+error: cannot find attribute macro `attr_proc_macra` in this scope
+  --> $DIR/resolve-error.rs:39:3
+   |
+39 | #[attr_proc_macra]
+   |   ^^^^^^^^^^^^^^^
+   |
+   = help: did you mean `attr_proc_macro`?
+
+error: cannot find attribute macro `FooWithLongNan` in this scope
+  --> $DIR/resolve-error.rs:42:3
+   |
+42 | #[FooWithLongNan]
+   |   ^^^^^^^^^^^^^^
+
+error: cannot find derive macro `Dlone` in this scope
+  --> $DIR/resolve-error.rs:45:10
+   |
+45 | #[derive(Dlone)]
+   |          ^^^^^
+   |
+   = help: did you mean `Clone`?
+
+error: cannot find derive macro `Dlona` in this scope
+  --> $DIR/resolve-error.rs:48:10
+   |
+48 | #[derive(Dlona)]
+   |          ^^^^^
+   |
+   = help: did you mean `Clona`?
+
+error: cannot find derive macro `attr_proc_macra` in this scope
+  --> $DIR/resolve-error.rs:51:10
+   |
+51 | #[derive(attr_proc_macra)]
+   |          ^^^^^^^^^^^^^^^
+
+error: cannot find macro `FooWithLongNama!` in this scope
+  --> $DIR/resolve-error.rs:55:5
+   |
+55 |     FooWithLongNama!();
+   |     ^^^^^^^^^^^^^^^
+   |
+   = help: did you mean `FooWithLongNam!`?
+
+error: cannot find macro `attr_proc_macra!` in this scope
+  --> $DIR/resolve-error.rs:57:5
+   |
+57 |     attr_proc_macra!();
+   |     ^^^^^^^^^^^^^^^
+   |
+   = help: did you mean `attr_proc_mac!`?
+
+error: cannot find macro `Dlona!` in this scope
+  --> $DIR/resolve-error.rs:59:5
+   |
+59 |     Dlona!();
+   |     ^^^^^
+
+error: cannot find macro `bang_proc_macrp!` in this scope
+  --> $DIR/resolve-error.rs:61:5
+   |
+61 |     bang_proc_macrp!();
+   |     ^^^^^^^^^^^^^^^
+   |
+   = help: did you mean `bang_proc_macro!`?
+
+error: aborting due to 10 previous errors
+
diff --git a/src/test/compile-fail/cast-to-unsized-trait-object-suggestion.rs b/src/test/ui/cast-to-unsized-trait-object-suggestion.rs
index d18746cdf0b..c7934547982 100644
--- a/src/test/compile-fail/cast-to-unsized-trait-object-suggestion.rs
+++ b/src/test/ui/cast-to-unsized-trait-object-suggestion.rs
@@ -10,11 +10,5 @@
 
 fn main() {
     &1 as Send;
-    //~^ ERROR cast to unsized type
-    //~| HELP try casting to a reference instead:
-    //~| SUGGESTION &1 as &Send;
     Box::new(1) as Send;
-    //~^ ERROR cast to unsized type
-    //~| HELP try casting to a `Box` instead:
-    //~| SUGGESTION Box::new(1) as Box<Send>;
 }
diff --git a/src/test/ui/cast-to-unsized-trait-object-suggestion.stderr b/src/test/ui/cast-to-unsized-trait-object-suggestion.stderr
new file mode 100644
index 00000000000..dd9c2d14ef2
--- /dev/null
+++ b/src/test/ui/cast-to-unsized-trait-object-suggestion.stderr
@@ -0,0 +1,18 @@
+error: cast to unsized type: `&{integer}` as `std::marker::Send`
+  --> $DIR/cast-to-unsized-trait-object-suggestion.rs:12:5
+   |
+12 |     &1 as Send;
+   |     ^^^^^^----
+   |           |
+   |           help: try casting to a reference instead: `&Send`
+
+error: cast to unsized type: `std::boxed::Box<{integer}>` as `std::marker::Send`
+  --> $DIR/cast-to-unsized-trait-object-suggestion.rs:13:5
+   |
+13 |     Box::new(1) as Send;
+   |     ^^^^^^^^^^^^^^^----
+   |                    |
+   |                    help: try casting to a `Box` instead: `Box<Send>`
+
+error: aborting due to previous error(s)
+
diff --git a/src/test/compile-fail/issue-35675.rs b/src/test/ui/issue-35675.rs
index 001c1f2eddc..001c1f2eddc 100644
--- a/src/test/compile-fail/issue-35675.rs
+++ b/src/test/ui/issue-35675.rs
diff --git a/src/test/ui/issue-35675.stderr b/src/test/ui/issue-35675.stderr
new file mode 100644
index 00000000000..22322a388c5
--- /dev/null
+++ b/src/test/ui/issue-35675.stderr
@@ -0,0 +1,74 @@
+error[E0412]: cannot find type `Apple` in this scope
+  --> $DIR/issue-35675.rs:20:29
+   |
+20 | fn should_return_fruit() -> Apple {
+   |                             ^^^^^ not found in this scope
+   |
+help: there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`?
+  --> $DIR/issue-35675.rs:14:5
+   |
+14 |     Apple(i64),
+   |     ^^^^^^^^^^
+
+error[E0425]: cannot find function `Apple` in this scope
+  --> $DIR/issue-35675.rs:23:5
+   |
+23 |     Apple(5)
+   |     ^^^^^ not found in this scope
+   |
+help: possible candidate is found in another module, you can import it into scope
+   | use Fruit::Apple;
+
+error[E0573]: expected type, found variant `Fruit::Apple`
+  --> $DIR/issue-35675.rs:28:33
+   |
+28 | fn should_return_fruit_too() -> Fruit::Apple {
+   |                                 ^^^^^^^^^^^^ not a type
+   |
+help: there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`?
+  --> $DIR/issue-35675.rs:14:5
+   |
+14 |     Apple(i64),
+   |     ^^^^^^^^^^
+
+error[E0425]: cannot find function `Apple` in this scope
+  --> $DIR/issue-35675.rs:31:5
+   |
+31 |     Apple(5)
+   |     ^^^^^ not found in this scope
+   |
+help: possible candidate is found in another module, you can import it into scope
+   | use Fruit::Apple;
+
+error[E0573]: expected type, found variant `Ok`
+  --> $DIR/issue-35675.rs:36:13
+   |
+36 | fn foo() -> Ok {
+   |             ^^ not a type
+   |
+   = help: there is an enum variant `std::prelude::v1::Ok`, did you mean to use `std::prelude::v1`?
+   = help: there is an enum variant `std::prelude::v1::Result::Ok`, did you mean to use `std::prelude::v1::Result`?
+
+error[E0412]: cannot find type `Variant3` in this scope
+  --> $DIR/issue-35675.rs:44:13
+   |
+44 | fn bar() -> Variant3 {
+   |             ^^^^^^^^ not found in this scope
+   |
+help: there is an enum variant `x::Enum::Variant3`, did you mean to use `x::Enum`?
+  --> $DIR/issue-35675.rs:63:9
+   |
+63 |         Variant3(usize),
+   |         ^^^^^^^^^^^^^^^
+
+error[E0573]: expected type, found variant `Some`
+  --> $DIR/issue-35675.rs:49:13
+   |
+49 | fn qux() -> Some {
+   |             ^^^^ not a type
+   |
+   = help: there is an enum variant `std::option::Option::Some`, did you mean to use `std::option::Option`?
+   = help: there is an enum variant `std::prelude::v1::Some`, did you mean to use `std::prelude::v1`?
+
+error: aborting due to previous error(s)
+
diff --git a/src/test/compile-fail/macro-name-typo.rs b/src/test/ui/macros/macro-name-typo.rs
index 4840205fee4..ec8d27f9138 100644
--- a/src/test/compile-fail/macro-name-typo.rs
+++ b/src/test/ui/macros/macro-name-typo.rs
@@ -10,6 +10,4 @@
 
 fn main() {
     printlx!("oh noes!");
-    //~^ ERROR cannot find macro
-    //~^^ HELP did you mean `println!`?
 }
diff --git a/src/test/ui/macros/macro-name-typo.stderr b/src/test/ui/macros/macro-name-typo.stderr
new file mode 100644
index 00000000000..c54de468d13
--- /dev/null
+++ b/src/test/ui/macros/macro-name-typo.stderr
@@ -0,0 +1,10 @@
+error: cannot find macro `printlx!` in this scope
+  --> $DIR/macro-name-typo.rs:12:5
+   |
+12 |     printlx!("oh noes!");
+   |     ^^^^^^^
+   |
+   = help: did you mean `println!`?
+
+error: aborting due to previous error(s)
+
diff --git a/src/test/compile-fail/macro_undefined.rs b/src/test/ui/macros/macro_undefined.rs
index 00c8d44f306..db93ba5e2c4 100644
--- a/src/test/compile-fail/macro_undefined.rs
+++ b/src/test/ui/macros/macro_undefined.rs
@@ -19,9 +19,5 @@ mod m {
 
 fn main() {
     k!();
-    //~^ ERROR cannot find macro `k!` in this scope
-    //~^^ HELP did you mean `kl!`?
     kl!();
-    //~^ ERROR cannot find macro `kl!` in this scope
-    //~^^ HELP have you added the `#[macro_use]` on the module/import?
 }
diff --git a/src/test/ui/macros/macro_undefined.stderr b/src/test/ui/macros/macro_undefined.stderr
new file mode 100644
index 00000000000..152de056991
--- /dev/null
+++ b/src/test/ui/macros/macro_undefined.stderr
@@ -0,0 +1,18 @@
+error: cannot find macro `kl!` in this scope
+  --> $DIR/macro_undefined.rs:22:5
+   |
+22 |     kl!();
+   |     ^^
+   |
+   = help: have you added the `#[macro_use]` on the module/import?
+
+error: cannot find macro `k!` in this scope
+  --> $DIR/macro_undefined.rs:21:5
+   |
+21 |     k!();
+   |     ^
+   |
+   = help: did you mean `kl!`?
+
+error: aborting due to previous error(s)
+
diff --git a/src/test/ui/resolve-error.stderr b/src/test/ui/resolve-error.stderr
new file mode 100644
index 00000000000..946eaba45fc
--- /dev/null
+++ b/src/test/ui/resolve-error.stderr
@@ -0,0 +1,76 @@
+error: cannot find derive macro `FooWithLongNan` in this scope
+  --> $DIR/resolve-error.rs:37:10
+   |
+37 | #[derive(FooWithLongNan)]
+   |          ^^^^^^^^^^^^^^
+   |
+   = help: did you mean `FooWithLongName`?
+
+error: cannot find attribute macro `attr_proc_macra` in this scope
+  --> $DIR/resolve-error.rs:40:3
+   |
+40 | #[attr_proc_macra]
+   |   ^^^^^^^^^^^^^^^
+   |
+   = help: did you mean `attr_proc_macro`?
+
+error: cannot find attribute macro `FooWithLongNan` in this scope
+  --> $DIR/resolve-error.rs:43:3
+   |
+43 | #[FooWithLongNan]
+   |   ^^^^^^^^^^^^^^
+
+error: cannot find derive macro `Dlone` in this scope
+  --> $DIR/resolve-error.rs:46:10
+   |
+46 | #[derive(Dlone)]
+   |          ^^^^^
+   |
+   = help: did you mean `Clone`?
+
+error: cannot find derive macro `Dlona` in this scope
+  --> $DIR/resolve-error.rs:49:10
+   |
+49 | #[derive(Dlona)]
+   |          ^^^^^
+   |
+   = help: did you mean `Clona`?
+
+error: cannot find derive macro `attr_proc_macra` in this scope
+  --> $DIR/resolve-error.rs:52:10
+   |
+52 | #[derive(attr_proc_macra)]
+   |          ^^^^^^^^^^^^^^^
+
+error: cannot find macro `FooWithLongNama!` in this scope
+  --> $DIR/resolve-error.rs:56:5
+   |
+56 |     FooWithLongNama!();
+   |     ^^^^^^^^^^^^^^^
+   |
+   = help: did you mean `FooWithLongNam!`?
+
+error: cannot find macro `attr_proc_macra!` in this scope
+  --> $DIR/resolve-error.rs:58:5
+   |
+58 |     attr_proc_macra!();
+   |     ^^^^^^^^^^^^^^^
+   |
+   = help: did you mean `attr_proc_mac!`?
+
+error: cannot find macro `Dlona!` in this scope
+  --> $DIR/resolve-error.rs:60:5
+   |
+60 |     Dlona!();
+   |     ^^^^^
+
+error: cannot find macro `bang_proc_macrp!` in this scope
+  --> $DIR/resolve-error.rs:62:5
+   |
+62 |     bang_proc_macrp!();
+   |     ^^^^^^^^^^^^^^^
+   |
+   = help: did you mean `bang_proc_macro!`?
+
+error: aborting due to previous error(s)
+