Skip to content

Commit 4a28663

Browse files
committed
Move some tests from compile-fail to ui
1 parent 08652ec commit 4a28663

15 files changed

+364
-29
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// force-host
12+
// no-prefer-dynamic
13+
#![feature(proc_macro)]
14+
#![crate_type = "proc-macro"]
15+
16+
extern crate proc_macro;
17+
18+
use proc_macro::TokenStream;
19+
20+
#[proc_macro_attribute]
21+
pub fn attr_proc_macro(_: TokenStream, input: TokenStream) -> TokenStream {
22+
input
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// force-host
12+
// no-prefer-dynamic
13+
#![feature(proc_macro)]
14+
#![crate_type = "proc-macro"]
15+
16+
extern crate proc_macro;
17+
18+
use proc_macro::TokenStream;
19+
20+
#[proc_macro]
21+
pub fn bang_proc_macro(input: TokenStream) -> TokenStream {
22+
input
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// force-host
12+
// no-prefer-dynamic
13+
14+
#![crate_type = "proc-macro"]
15+
16+
extern crate proc_macro;
17+
18+
use proc_macro::TokenStream;
19+
20+
#[proc_macro_derive(Clona)]
21+
pub fn derive_clonea(input: TokenStream) -> TokenStream {
22+
"".parse().unwrap()
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// force-host
12+
// no-prefer-dynamic
13+
14+
#![crate_type = "proc-macro"]
15+
16+
extern crate proc_macro;
17+
18+
use proc_macro::TokenStream;
19+
20+
#[proc_macro_derive(FooWithLongName)]
21+
pub fn derive_foo(input: TokenStream) -> TokenStream {
22+
"".parse().unwrap()
23+
}

src/test/compile-fail-fulldeps/proc-macro/resolve-error.rs renamed to src/test/ui-fulldeps/resolve-error.rs

-17
Original file line numberDiff line numberDiff line change
@@ -35,46 +35,29 @@ macro_rules! attr_proc_mac {
3535
}
3636

3737
#[derive(FooWithLongNan)]
38-
//~^ ERROR cannot find derive macro `FooWithLongNan` in this scope
39-
//~^^ HELP did you mean `FooWithLongName`?
4038
struct Foo;
4139

4240
#[attr_proc_macra]
43-
//~^ ERROR cannot find attribute macro `attr_proc_macra` in this scope
44-
//~^^ HELP did you mean `attr_proc_macro`?
4541
struct Bar;
4642

4743
#[FooWithLongNan]
48-
//~^ ERROR cannot find attribute macro `FooWithLongNan` in this scope
4944
struct Asdf;
5045

5146
#[derive(Dlone)]
52-
//~^ ERROR cannot find derive macro `Dlone` in this scope
53-
//~^^ HELP did you mean `Clone`?
5447
struct A;
5548

5649
#[derive(Dlona)]
57-
//~^ ERROR cannot find derive macro `Dlona` in this scope
58-
//~^^ HELP did you mean `Clona`?
5950
struct B;
6051

6152
#[derive(attr_proc_macra)]
62-
//~^ ERROR cannot find derive macro `attr_proc_macra` in this scope
6353
struct C;
6454

6555
fn main() {
6656
FooWithLongNama!();
67-
//~^ ERROR cannot find macro `FooWithLongNama!` in this scope
68-
//~^^ HELP did you mean `FooWithLongNam!`?
6957

7058
attr_proc_macra!();
71-
//~^ ERROR cannot find macro `attr_proc_macra!` in this scope
72-
//~^^ HELP did you mean `attr_proc_mac!`?
7359

7460
Dlona!();
75-
//~^ ERROR cannot find macro `Dlona!` in this scope
7661

7762
bang_proc_macrp!();
78-
//~^ ERROR cannot find macro `bang_proc_macrp!` in this scope
79-
//~^^ HELP did you mean `bang_proc_macro!`?
8063
}
+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
error: cannot find derive macro `FooWithLongNan` in this scope
2+
--> $DIR/resolve-error.rs:36:10
3+
|
4+
36 | #[derive(FooWithLongNan)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= help: did you mean `FooWithLongName`?
8+
9+
error: cannot find attribute macro `attr_proc_macra` in this scope
10+
--> $DIR/resolve-error.rs:39:3
11+
|
12+
39 | #[attr_proc_macra]
13+
| ^^^^^^^^^^^^^^^
14+
|
15+
= help: did you mean `attr_proc_macro`?
16+
17+
error: cannot find attribute macro `FooWithLongNan` in this scope
18+
--> $DIR/resolve-error.rs:42:3
19+
|
20+
42 | #[FooWithLongNan]
21+
| ^^^^^^^^^^^^^^
22+
23+
error: cannot find derive macro `Dlone` in this scope
24+
--> $DIR/resolve-error.rs:45:10
25+
|
26+
45 | #[derive(Dlone)]
27+
| ^^^^^
28+
|
29+
= help: did you mean `Clone`?
30+
31+
error: cannot find derive macro `Dlona` in this scope
32+
--> $DIR/resolve-error.rs:48:10
33+
|
34+
48 | #[derive(Dlona)]
35+
| ^^^^^
36+
|
37+
= help: did you mean `Clona`?
38+
39+
error: cannot find derive macro `attr_proc_macra` in this scope
40+
--> $DIR/resolve-error.rs:51:10
41+
|
42+
51 | #[derive(attr_proc_macra)]
43+
| ^^^^^^^^^^^^^^^
44+
45+
error: cannot find macro `FooWithLongNama!` in this scope
46+
--> $DIR/resolve-error.rs:55:5
47+
|
48+
55 | FooWithLongNama!();
49+
| ^^^^^^^^^^^^^^^
50+
|
51+
= help: did you mean `FooWithLongNam!`?
52+
53+
error: cannot find macro `attr_proc_macra!` in this scope
54+
--> $DIR/resolve-error.rs:57:5
55+
|
56+
57 | attr_proc_macra!();
57+
| ^^^^^^^^^^^^^^^
58+
|
59+
= help: did you mean `attr_proc_mac!`?
60+
61+
error: cannot find macro `Dlona!` in this scope
62+
--> $DIR/resolve-error.rs:59:5
63+
|
64+
59 | Dlona!();
65+
| ^^^^^
66+
67+
error: cannot find macro `bang_proc_macrp!` in this scope
68+
--> $DIR/resolve-error.rs:61:5
69+
|
70+
61 | bang_proc_macrp!();
71+
| ^^^^^^^^^^^^^^^
72+
|
73+
= help: did you mean `bang_proc_macro!`?
74+
75+
error: aborting due to 10 previous errors
76+

src/test/compile-fail/cast-to-unsized-trait-object-suggestion.rs renamed to src/test/ui/cast-to-unsized-trait-object-suggestion.rs

-6
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,5 @@
1010

1111
fn main() {
1212
&1 as Send;
13-
//~^ ERROR cast to unsized type
14-
//~| HELP try casting to a reference instead:
15-
//~| SUGGESTION &1 as &Send;
1613
Box::new(1) as Send;
17-
//~^ ERROR cast to unsized type
18-
//~| HELP try casting to a `Box` instead:
19-
//~| SUGGESTION Box::new(1) as Box<Send>;
2014
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: cast to unsized type: `&{integer}` as `std::marker::Send`
2+
--> $DIR/cast-to-unsized-trait-object-suggestion.rs:12:5
3+
|
4+
12 | &1 as Send;
5+
| ^^^^^^----
6+
| |
7+
| help: try casting to a reference instead: `&Send`
8+
9+
error: cast to unsized type: `std::boxed::Box<{integer}>` as `std::marker::Send`
10+
--> $DIR/cast-to-unsized-trait-object-suggestion.rs:13:5
11+
|
12+
13 | Box::new(1) as Send;
13+
| ^^^^^^^^^^^^^^^----
14+
| |
15+
| help: try casting to a `Box` instead: `Box<Send>`
16+
17+
error: aborting due to previous error(s)
18+
File renamed without changes.

src/test/ui/issue-35675.stderr

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
error[E0412]: cannot find type `Apple` in this scope
2+
--> $DIR/issue-35675.rs:20:29
3+
|
4+
20 | fn should_return_fruit() -> Apple {
5+
| ^^^^^ not found in this scope
6+
|
7+
help: there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`?
8+
--> $DIR/issue-35675.rs:14:5
9+
|
10+
14 | Apple(i64),
11+
| ^^^^^^^^^^
12+
13+
error[E0425]: cannot find function `Apple` in this scope
14+
--> $DIR/issue-35675.rs:23:5
15+
|
16+
23 | Apple(5)
17+
| ^^^^^ not found in this scope
18+
|
19+
help: possible candidate is found in another module, you can import it into scope
20+
| use Fruit::Apple;
21+
22+
error[E0573]: expected type, found variant `Fruit::Apple`
23+
--> $DIR/issue-35675.rs:28:33
24+
|
25+
28 | fn should_return_fruit_too() -> Fruit::Apple {
26+
| ^^^^^^^^^^^^ not a type
27+
|
28+
help: there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`?
29+
--> $DIR/issue-35675.rs:14:5
30+
|
31+
14 | Apple(i64),
32+
| ^^^^^^^^^^
33+
34+
error[E0425]: cannot find function `Apple` in this scope
35+
--> $DIR/issue-35675.rs:31:5
36+
|
37+
31 | Apple(5)
38+
| ^^^^^ not found in this scope
39+
|
40+
help: possible candidate is found in another module, you can import it into scope
41+
| use Fruit::Apple;
42+
43+
error[E0573]: expected type, found variant `Ok`
44+
--> $DIR/issue-35675.rs:36:13
45+
|
46+
36 | fn foo() -> Ok {
47+
| ^^ not a type
48+
|
49+
= help: there is an enum variant `std::prelude::v1::Ok`, did you mean to use `std::prelude::v1`?
50+
= help: there is an enum variant `std::prelude::v1::Result::Ok`, did you mean to use `std::prelude::v1::Result`?
51+
52+
error[E0412]: cannot find type `Variant3` in this scope
53+
--> $DIR/issue-35675.rs:44:13
54+
|
55+
44 | fn bar() -> Variant3 {
56+
| ^^^^^^^^ not found in this scope
57+
|
58+
help: there is an enum variant `x::Enum::Variant3`, did you mean to use `x::Enum`?
59+
--> $DIR/issue-35675.rs:63:9
60+
|
61+
63 | Variant3(usize),
62+
| ^^^^^^^^^^^^^^^
63+
64+
error[E0573]: expected type, found variant `Some`
65+
--> $DIR/issue-35675.rs:49:13
66+
|
67+
49 | fn qux() -> Some {
68+
| ^^^^ not a type
69+
|
70+
= help: there is an enum variant `std::option::Option::Some`, did you mean to use `std::option::Option`?
71+
= help: there is an enum variant `std::prelude::v1::Some`, did you mean to use `std::prelude::v1`?
72+
73+
error: aborting due to previous error(s)
74+

src/test/compile-fail/macro-name-typo.rs renamed to src/test/ui/macros/macro-name-typo.rs

-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@
1010

1111
fn main() {
1212
printlx!("oh noes!");
13-
//~^ ERROR cannot find macro
14-
//~^^ HELP did you mean `println!`?
1513
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: cannot find macro `printlx!` in this scope
2+
--> $DIR/macro-name-typo.rs:12:5
3+
|
4+
12 | printlx!("oh noes!");
5+
| ^^^^^^^
6+
|
7+
= help: did you mean `println!`?
8+
9+
error: aborting due to previous error(s)
10+

src/test/compile-fail/macro_undefined.rs renamed to src/test/ui/macros/macro_undefined.rs

-4
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,5 @@ mod m {
1919

2020
fn main() {
2121
k!();
22-
//~^ ERROR cannot find macro `k!` in this scope
23-
//~^^ HELP did you mean `kl!`?
2422
kl!();
25-
//~^ ERROR cannot find macro `kl!` in this scope
26-
//~^^ HELP have you added the `#[macro_use]` on the module/import?
2723
}
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: cannot find macro `kl!` in this scope
2+
--> $DIR/macro_undefined.rs:22:5
3+
|
4+
22 | kl!();
5+
| ^^
6+
|
7+
= help: have you added the `#[macro_use]` on the module/import?
8+
9+
error: cannot find macro `k!` in this scope
10+
--> $DIR/macro_undefined.rs:21:5
11+
|
12+
21 | k!();
13+
| ^
14+
|
15+
= help: did you mean `kl!`?
16+
17+
error: aborting due to previous error(s)
18+

0 commit comments

Comments
 (0)