Move some tests from compile-fail to ui
This commit is contained in:
parent
08652ec957
commit
4a286639e8
15 changed files with 364 additions and 29 deletions
23
src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs
Normal file
23
src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs
Normal file
|
|
@ -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
|
||||
}
|
||||
23
src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs
Normal file
23
src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs
Normal file
|
|
@ -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
|
||||
}
|
||||
23
src/test/ui-fulldeps/auxiliary/derive-clona.rs
Normal file
23
src/test/ui-fulldeps/auxiliary/derive-clona.rs
Normal file
|
|
@ -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()
|
||||
}
|
||||
23
src/test/ui-fulldeps/auxiliary/derive-foo.rs
Normal file
23
src/test/ui-fulldeps/auxiliary/derive-foo.rs
Normal file
|
|
@ -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()
|
||||
}
|
||||
|
|
@ -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!`?
|
||||
}
|
||||
76
src/test/ui-fulldeps/resolve-error.stderr
Normal file
76
src/test/ui-fulldeps/resolve-error.stderr
Normal file
|
|
@ -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
|
||||
|
||||
|
|
@ -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>;
|
||||
}
|
||||
18
src/test/ui/cast-to-unsized-trait-object-suggestion.stderr
Normal file
18
src/test/ui/cast-to-unsized-trait-object-suggestion.stderr
Normal file
|
|
@ -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)
|
||||
|
||||
74
src/test/ui/issue-35675.stderr
Normal file
74
src/test/ui/issue-35675.stderr
Normal file
|
|
@ -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)
|
||||
|
||||
|
|
@ -10,6 +10,4 @@
|
|||
|
||||
fn main() {
|
||||
printlx!("oh noes!");
|
||||
//~^ ERROR cannot find macro
|
||||
//~^^ HELP did you mean `println!`?
|
||||
}
|
||||
10
src/test/ui/macros/macro-name-typo.stderr
Normal file
10
src/test/ui/macros/macro-name-typo.stderr
Normal file
|
|
@ -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)
|
||||
|
||||
|
|
@ -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?
|
||||
}
|
||||
18
src/test/ui/macros/macro_undefined.stderr
Normal file
18
src/test/ui/macros/macro_undefined.stderr
Normal file
|
|
@ -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)
|
||||
|
||||
76
src/test/ui/resolve-error.stderr
Normal file
76
src/test/ui/resolve-error.stderr
Normal file
|
|
@ -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)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue