about summary refs log tree commit diff
path: root/tests/ui/parser/macro/macro-attr-bad.rs
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-10-02 10:27:49 +0200
committerGitHub <noreply@github.com>2025-10-02 10:27:49 +0200
commitac7beab527861103dd1e1515d534f87956786554 (patch)
tree52d7ecb9c0fd9d077a7a7a897d052734e2629cb7 /tests/ui/parser/macro/macro-attr-bad.rs
parent92aac1bdf61642cfc99498ca86e663cf53d2039e (diff)
parent4fc0a0d42a66e9b248fa527f7f063ec7226803dd (diff)
downloadrust-ac7beab527861103dd1e1515d534f87956786554.tar.gz
rust-ac7beab527861103dd1e1515d534f87956786554.zip
Rollup merge of #146535 - joshtriplett:mbe-unsafe-attr, r=petrochenkov
mbe: Implement `unsafe` attribute rules

This implements `unsafe attr` rules for declarative `macro_rules!` attributes, as specified in [RFC 3697](https://github.com/rust-lang/rfcs/pull/3697).

An invocation of an attribute that uses an `unsafe attr` rule requires the `unsafe(attr(...))` syntax.

An invocation of an attribute that uses an ordinary `attr` rule must *not* use the `unsafe(attr(...))` syntax.

`unsafe` is only supported on an `attr` rule, not any other kind of `macro_rules!` rule.

Tracking issue for `macro_rules!` attributes: https://github.com/rust-lang/rust/issues/143547
Diffstat (limited to 'tests/ui/parser/macro/macro-attr-bad.rs')
-rw-r--r--tests/ui/parser/macro/macro-attr-bad.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/ui/parser/macro/macro-attr-bad.rs b/tests/ui/parser/macro/macro-attr-bad.rs
index 9f50b057a7a..0ac46c8b768 100644
--- a/tests/ui/parser/macro/macro-attr-bad.rs
+++ b/tests/ui/parser/macro/macro-attr-bad.rs
@@ -13,6 +13,12 @@ macro_rules! attr_incomplete_3 { attr() {} }
 macro_rules! attr_incomplete_4 { attr() {} => }
 //~^ ERROR macro definition ended unexpectedly
 
+macro_rules! attr_incomplete_5 { unsafe }
+//~^ ERROR macro definition ended unexpectedly
+
+macro_rules! attr_incomplete_6 { unsafe attr }
+//~^ ERROR macro definition ended unexpectedly
+
 macro_rules! attr_noparens_1 { attr{} {} => {} }
 //~^ ERROR `attr` rule argument matchers require parentheses