Skip to content

Commit d374279

Browse files
committed
Migrate some tests away from concat-idents
`concat_idents!` is in the process of being removed, but a few things it is used to test will still be relevant. Migrate these tests to something other than `concat_idents`.
1 parent d1d8e38 commit d374279

File tree

5 files changed

+57
-24
lines changed

5 files changed

+57
-24
lines changed

tests/rustdoc-js/big-result.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(concat_idents)]
21
#![allow(nonstandard_style)]
32
/// Generate 250 items that all match the query, starting with the longest.
43
/// Those long items should be dropped from the result set, and the short ones

tests/ui/issues/issue-32950.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
#![feature(concat_idents)]
2-
#![expect(deprecated)] // concat_idents is deprecated
1+
// Issue 32950
2+
// Ensure that using macros rather than a type doesn't break `derive`.
33

44
#[derive(Debug)]
5-
struct Baz<T>(
6-
concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros
7-
//~^ ERROR cannot find type `FooBar` in this scope
8-
);
5+
struct Nonsense<T> {
6+
//~^ ERROR type parameter `T` is never used
7+
should_be_vec_t: vec![T]
8+
//~^ ERROR `derive` cannot be used on items with type macros
9+
//~| ERROR expected type, found `expr` metavariable
10+
}
911

1012
fn main() {}

tests/ui/issues/issue-32950.stderr

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
error: `derive` cannot be used on items with type macros
2-
--> $DIR/issue-32950.rs:6:5
2+
--> $DIR/nonsense-input-to-debug.rs:7:22
33
|
4-
LL | concat_idents!(Foo, Bar)
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | should_be_vec_t: vec![T]
5+
| ^^^^^^^
66

7-
error[E0412]: cannot find type `FooBar` in this scope
8-
--> $DIR/issue-32950.rs:6:5
7+
error: expected type, found `expr` metavariable
8+
--> $DIR/nonsense-input-to-debug.rs:7:22
99
|
10-
LL | concat_idents!(Foo, Bar)
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
10+
LL | should_be_vec_t: vec![T]
11+
| ^^^^^^^
12+
| |
13+
| expected type
14+
| in this macro invocation
15+
| this macro call doesn't expand to a type
16+
|
17+
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
18+
19+
error[E0392]: type parameter `T` is never used
20+
--> $DIR/nonsense-input-to-debug.rs:5:17
21+
|
22+
LL | struct Nonsense<T> {
23+
| ^ unused type parameter
24+
|
25+
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
26+
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
1227

13-
error: aborting due to 2 previous errors
28+
error: aborting due to 3 previous errors
1429

15-
For more information about this error, try `rustc --explain E0412`.
30+
For more information about this error, try `rustc --explain E0392`.

tests/ui/issues/issue-50403.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
#![feature(concat_idents)]
2-
#![expect(deprecated)] // concat_idents is deprecated
1+
// Issue 50403
2+
// Ensure that `concat` can't create empty identifiers
3+
// FIXME(macro_metavar_expr_concat): this error message could be improved
4+
5+
macro_rules! empty {
6+
() => { ${concat()} } //~ ERROR expected identifier or string literal
7+
//~^ERROR expected expression
8+
}
39

410
fn main() {
5-
let x = concat_idents!(); //~ ERROR `concat_idents!()` takes 1 or more arguments
11+
let x = empty!();
612
}

tests/ui/issues/issue-50403.stderr

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1-
error: `concat_idents!()` takes 1 or more arguments
2-
--> $DIR/issue-50403.rs:5:13
1+
error: expected identifier or string literal
2+
--> $DIR/empty-input.rs:6:14
33
|
4-
LL | let x = concat_idents!();
5-
| ^^^^^^^^^^^^^^^^
4+
LL | () => { ${concat()} }
5+
| ^^^^^^^^^^
66

7-
error: aborting due to 1 previous error
7+
error: expected expression, found `$`
8+
--> $DIR/empty-input.rs:6:13
9+
|
10+
LL | () => { ${concat()} }
11+
| ^ expected expression
12+
...
13+
LL | let x = empty!();
14+
| -------- in this macro invocation
15+
|
16+
= note: this error originates in the macro `empty` (in Nightly builds, run with -Z macro-backtrace for more info)
17+
18+
error: aborting due to 2 previous errors
819

0 commit comments

Comments
 (0)