Skip to content

Commit f31b6ab

Browse files
committed
Move former compile-fail-fulldeps tests to ui
1 parent 8660eba commit f31b6ab

File tree

80 files changed

+662
-46
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+662
-46
lines changed

src/test/compile-fail/proc-macro/auxiliary/derive-clona.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/test/compile-fail/proc-macro/auxiliary/derive-foo.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
error: expected expression, found `<eof>`
2+
--> $DIR/attr-invalid-exprs.rs:21:13
3+
|
4+
LL | let _ = #[no_output] "Hello, world!";
5+
| ^^^^^^^^^^^^
6+
7+
error: macro expansion ignores token `,` and any following
8+
--> $DIR/attr-invalid-exprs.rs:24:13
9+
|
10+
LL | let _ = #[duplicate] "Hello, world!";
11+
| ^^^^^^^^^^^^- help: you might be missing a semicolon here: `;`
12+
| |
13+
| caused by the macro expansion here
14+
|
15+
= note: the usage of `duplicate!` is likely invalid in expression context
16+
17+
error: macro expansion ignores token `,` and any following
18+
--> $DIR/attr-invalid-exprs.rs:33:9
19+
|
20+
LL | #[duplicate]
21+
| ^^^^^^^^^^^^- help: you might be missing a semicolon here: `;`
22+
| |
23+
| caused by the macro expansion here
24+
|
25+
= note: the usage of `duplicate!` is likely invalid in expression context
26+
27+
error: aborting due to 3 previous errors
28+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0658]: attributes on expressions are experimental. (see issue #15701)
2+
--> $DIR/attr-stmt-expr.rs:20:5
3+
|
4+
LL | #[expect_print_expr]
5+
| ^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable
8+
9+
error[E0658]: attributes on expressions are experimental. (see issue #15701)
10+
--> $DIR/attr-stmt-expr.rs:33:5
11+
|
12+
LL | #[expect_expr]
13+
| ^^^^^^^^^^^^^^
14+
|
15+
= help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable
16+
17+
error: aborting due to 2 previous errors
18+
19+
For more information about this error, try `rustc --explain E0658`.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/attribute-with-error.rs:21:18
3+
|
4+
LL | let a: i32 = "foo";
5+
| ^^^^^ expected i32, found reference
6+
|
7+
= note: expected type `i32`
8+
found type `&'static str`
9+
10+
error[E0308]: mismatched types
11+
--> $DIR/attribute-with-error.rs:23:18
12+
|
13+
LL | let b: i32 = "f'oo";
14+
| ^^^^^^ expected i32, found reference
15+
|
16+
= note: expected type `i32`
17+
found type `&'static str`
18+
19+
error[E0308]: mismatched types
20+
--> $DIR/attribute-with-error.rs:36:22
21+
|
22+
LL | let a: i32 = "foo";
23+
| ^^^^^ expected i32, found reference
24+
|
25+
= note: expected type `i32`
26+
found type `&'static str`
27+
28+
error[E0308]: mismatched types
29+
--> $DIR/attribute-with-error.rs:46:22
30+
|
31+
LL | let a: i32 = "foo";
32+
| ^^^^^ expected i32, found reference
33+
|
34+
= note: expected type `i32`
35+
found type `&'static str`
36+
37+
error: aborting due to 4 previous errors
38+
39+
For more information about this error, try `rustc --explain E0308`.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
error: attribute must be of form: #[proc_macro_derive(TraitName)]
2+
--> $DIR/attribute.rs:18:1
3+
|
4+
LL | #[proc_macro_derive]
5+
| ^^^^^^^^^^^^^^^^^^^^
6+
7+
error: attribute must be of form: #[proc_macro_derive(TraitName)]
8+
--> $DIR/attribute.rs:24:1
9+
|
10+
LL | #[proc_macro_derive = "foo"]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: must only be one word
14+
--> $DIR/attribute.rs:31:5
15+
|
16+
LL | a = "b"
17+
| ^^^^^^^
18+
19+
error: attribute must have either one or two arguments
20+
--> $DIR/attribute.rs:38:1
21+
|
22+
LL | #[proc_macro_derive(b, c, d)]
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
25+
error: must only be one word
26+
--> $DIR/attribute.rs:44:21
27+
|
28+
LL | #[proc_macro_derive(d(e))]
29+
| ^^^^
30+
31+
error: must only be one word
32+
--> $DIR/attribute.rs:50:35
33+
|
34+
LL | #[proc_macro_derive(f, attributes(g = "h"))]
35+
| ^^^^^^^
36+
37+
error: must only be one word
38+
--> $DIR/attribute.rs:56:35
39+
|
40+
LL | #[proc_macro_derive(i, attributes(j(k)))]
41+
| ^^^^
42+
43+
error: attribute must have either one or two arguments
44+
--> $DIR/attribute.rs:62:1
45+
|
46+
LL | #[proc_macro_derive(l, attributes(m), n)]
47+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48+
49+
error: aborting due to 8 previous errors
50+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
warning: unused variable: `a`
2+
--> $DIR/attributes-included.rs:27:9
3+
|
4+
LL | let a: i32 = "foo"; //~ WARN: unused variable
5+
| ^ help: consider using `_a` instead
6+
|
7+
note: lint level defined here
8+
--> $DIR/attributes-included.rs:14:9
9+
|
10+
LL | #![warn(unused)]
11+
| ^^^^^^
12+
= note: #[warn(unused_variables)] implied by #[warn(unused)]
13+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0428]: the name `A` is defined multiple times
2+
--> $DIR/define-two.rs:25:21
3+
|
4+
LL | #[proc_macro_derive(A)]
5+
| - previous definition of the macro `A` here
6+
...
7+
LL | #[proc_macro_derive(A)] //~ ERROR the name `A` is defined multiple times
8+
| ^ `A` redefined here
9+
|
10+
= note: `A` must be defined only once in the macro namespace of this module
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0428`.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: expected `:`, found `}`
2+
--> $DIR/derive-bad.rs:17:5
3+
|
4+
LL | A
5+
| ^ expected `:`
6+
7+
error: proc-macro derive produced unparseable tokens
8+
--> $DIR/derive-bad.rs:17:5
9+
|
10+
LL | A
11+
| ^
12+
13+
error: aborting due to 2 previous errors
14+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644)
2+
--> $DIR/derive-still-gated.rs:18:3
3+
|
4+
LL | #[derive_A] //~ ERROR: attributes of the form `#[derive_*]` are reserved for the compiler
5+
| ^^^^^^^^
6+
|
7+
= help: add #![feature(custom_derive)] to the crate attributes to enable
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0658`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642)
2+
--> $DIR/expand-to-unstable-2.rs:18:10
3+
|
4+
LL | #[derive(Unstable)]
5+
| ^^^^^^^^
6+
|
7+
= help: add #![feature(rustc_attrs)] to the crate attributes to enable
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0658`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0658]: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library
2+
--> $DIR/expand-to-unstable.rs:18:10
3+
|
4+
LL | #[derive(Unstable)]
5+
| ^^^^^^^^
6+
|
7+
= help: add #![feature(core_intrinsics)] to the crate attributes to enable
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0658`.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: cannot export macro_rules! macros from a `proc-macro` crate type currently
2+
--> $DIR/export-macro.rs:19:1
3+
|
4+
LL | / macro_rules! foo {
5+
LL | | ($e:expr) => ($e)
6+
LL | | }
7+
| |_^
8+
9+
error: aborting due to previous error
10+

src/test/ui/proc-macro/exports.stderr

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently
2+
--> $DIR/exports.rs:17:1
3+
|
4+
LL | pub fn a() {} //~ ERROR: cannot export any items
5+
| ^^^^^^^^^^^^^
6+
7+
error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently
8+
--> $DIR/exports.rs:18:1
9+
|
10+
LL | pub struct B; //~ ERROR: cannot export any items
11+
| ^^^^^^^^^^^^^
12+
13+
error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently
14+
--> $DIR/exports.rs:19:1
15+
|
16+
LL | pub enum C {} //~ ERROR: cannot export any items
17+
| ^^^^^^^^^^^^^
18+
19+
error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently
20+
--> $DIR/exports.rs:20:1
21+
|
22+
LL | pub mod d {} //~ ERROR: cannot export any items
23+
| ^^^^^^^^^^^^
24+
25+
error: aborting due to 4 previous errors
26+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type
2+
--> $DIR/illegal-proc-macro-derive-use.rs:13:1
3+
|
4+
LL | #[proc_macro_derive(Foo)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error: the `#[proc_macro_derive]` attribute may only be used on bare functions
8+
--> $DIR/illegal-proc-macro-derive-use.rs:20:1
9+
|
10+
LL | #[proc_macro_derive(Foo)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to 2 previous errors
14+

src/test/ui/proc-macro/import.stderr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0432]: unresolved import `derive_a::derive_a`
2+
--> $DIR/import.rs:18:5
3+
|
4+
LL | use derive_a::derive_a;
5+
| ^^^^^^^^^^^^^^^^^^ no `derive_a` in the root
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0432`.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/issue-37788.rs:18:5
3+
|
4+
LL | fn main() {
5+
| - expected `()` because of default return type
6+
LL | // Test that constructing the `visible_parent_map` (in `cstore_impl.rs`) does not ICE.
7+
LL | std::cell::Cell::new(0) //~ ERROR mismatched types
8+
| ^^^^^^^^^^^^^^^^^^^^^^^- help: try adding a semicolon: `;`
9+
| |
10+
| expected (), found struct `std::cell::Cell`
11+
|
12+
= note: expected type `()`
13+
found type `std::cell::Cell<{integer}>`
14+
15+
error: aborting due to previous error
16+
17+
For more information about this error, try `rustc --explain E0308`.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0425]: cannot find value `foo` in this scope
2+
--> $DIR/issue-38586.rs:16:10
3+
|
4+
LL | #[derive(A)] //~ ERROR `foo`
5+
| ^ not found in this scope
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0425`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0658]: The attribute `emit_unchanged` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
2+
--> $DIR/issue-41211.rs:18:4
3+
|
4+
LL | #![emit_unchanged]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0658`.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: visibilities can only be restricted to ancestor modules
2+
--> $DIR/issue-50493.rs:18:12
3+
|
4+
LL | pub(in restricted) field: usize, //~ visibilities can only be restricted to ancestor modules
5+
| ^^^^^^^^^^
6+
7+
error[E0616]: field `field` of struct `Restricted` is private
8+
--> $DIR/issue-50493.rs:16:10
9+
|
10+
LL | #[derive(Derive)] //~ ERROR field `field` of struct `Restricted` is private
11+
| ^^^^^^
12+
13+
error: aborting due to 2 previous errors
14+
15+
For more information about this error, try `rustc --explain E0616`.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0106]: missing lifetime specifier
2+
--> $DIR/item-error.rs:20:8
3+
|
4+
LL | a: &u64
5+
| ^ expected lifetime parameter
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0106`.

0 commit comments

Comments
 (0)