summaryrefslogtreecommitdiffstats
path: root/tests/ui/parser/macro/macro-expand-to-field.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/parser/macro/macro-expand-to-field.rs')
-rw-r--r--tests/ui/parser/macro/macro-expand-to-field.rs31
1 files changed, 20 insertions, 11 deletions
diff --git a/tests/ui/parser/macro/macro-expand-to-field.rs b/tests/ui/parser/macro/macro-expand-to-field.rs
index 155872f7a..533511ecf 100644
--- a/tests/ui/parser/macro/macro-expand-to-field.rs
+++ b/tests/ui/parser/macro/macro-expand-to-field.rs
@@ -1,5 +1,7 @@
// compile-flags: --crate-type=lib
+// https://github.com/rust-lang/rust/issues/113766
+
macro_rules! field {
($name:ident:$type:ty) => {
$name:$type
@@ -13,15 +15,14 @@ macro_rules! variant {
}
struct Struct {
+ //~^ NOTE while parsing this struct
field!(bar:u128),
//~^ NOTE macros cannot expand to struct fields
//~| ERROR unexpected token: `!`
//~| NOTE unexpected token after this
a: u32,
b: u32,
- field!(recovers:()), //~ NOTE macros cannot expand to struct fields
- //~^ ERROR unexpected token: `!`
- //~^^ NOTE unexpected token after this
+ field!(recovers:()),
}
enum EnumVariant {
@@ -35,7 +36,7 @@ enum EnumVariant {
//~^ NOTE macros cannot expand to enum variants
//~| ERROR unexpected token: `!`
//~| NOTE unexpected token after this
- Data {
+ Data { //~ NOTE while parsing this struct
field!(x:u32),
//~^ NOTE macros cannot expand to struct fields
//~| ERROR unexpected token: `!`
@@ -44,27 +45,35 @@ enum EnumVariant {
}
enum EnumVariantField {
- Named {
+ Named { //~ NOTE while parsing this struct
field!(oopsies:()),
//~^ NOTE macros cannot expand to struct fields
//~| ERROR unexpected token: `!`
//~| unexpected token after this
field!(oopsies2:()),
- //~^ NOTE macros cannot expand to struct fields
- //~| ERROR unexpected token: `!`
- //~| unexpected token after this
},
}
union Union {
+ //~^ NOTE while parsing this union
A: u32,
field!(oopsies:()),
//~^ NOTE macros cannot expand to union fields
//~| ERROR unexpected token: `!`
- //~| unexpected token after this
+ //~| NOTE unexpected token after this
B: u32,
field!(recovers:()),
- //~^ NOTE macros cannot expand to union fields
+}
+
+// https://github.com/rust-lang/rust/issues/114636
+
+#[derive(Debug)]
+pub struct Lazy {
+ //~^ NOTE while parsing this struct
+ unreachable!()
+ //~^ NOTE macros cannot expand to struct fields
//~| ERROR unexpected token: `!`
- //~| unexpected token after this
+ //~| NOTE unexpected token after this
}
+
+fn main() {}