From ba1b6e7d182ae2d8316d28c574d4a4301b29f96d Mon Sep 17 00:00:00 2001 From: Pete LeVasseur Date: Sat, 31 Jan 2026 11:49:04 +0900 Subject: [PATCH 01/13] docs(inline-assembly): document asm_cfg attributes --- src/changelog.rst | 11 ++++++++ src/inline-assembly.rst | 61 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 69 insertions(+), 3 deletions(-) diff --git a/src/changelog.rst b/src/changelog.rst index 87ebd213..7a3c58a0 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -35,6 +35,17 @@ Language changes in Rust 1.93.0 - No change: this bug was not documented in FLS - `Stabilize asm_cfg `_ + + - Changed syntax: :s:`AssemblyCodeBlock`, :s:`AsmArguments`, :s:`GlobalAsmArguments` + - New syntax: :s:`AsmTemplate`, :s:`AsmAttrRegisterArgument`, :s:`AsmAttrAbiClobber`, :s:`AsmAttrAssemblyOption` + + - New paragraphs: + + - :p:`fls_m0SBtonaNppV` + - :p:`fls_nLBhw2w6uznH` + - :p:`fls_xzDPz2zfRfoI` + - :p:`fls_cTEiqjf6haEg` + - `During const-evaluation, support copying pointers byte-by-byte `_ * No change: Already covered by the classification of :t:`[constant expression]s`. diff --git a/src/inline-assembly.rst b/src/inline-assembly.rst index b54cb9c0..2861ca85 100644 --- a/src/inline-assembly.rst +++ b/src/inline-assembly.rst @@ -963,7 +963,10 @@ Assembly Instructions .. syntax:: AssemblyCodeBlock ::= - AssemblyInstruction ($$,$$ AssemblyInstruction)* + AsmTemplate ($$,$$ AsmTemplate)* + + AsmTemplate ::= + OuterAttribute* AssemblyInstruction AssemblyInstruction ::= StringLiteral @@ -1615,6 +1618,49 @@ It is undefined behavior if control reaches the end of an options(nomem, pure) +.. _fls_tWub9IMeq68B: + +Attributes +---------- + +.. rubric:: Legality Rules + +:dp:`fls_m0SBtonaNppV` +The :s:`AssemblyInstruction`, :s:`RegisterArgument`, :s:`AbiClobber`, and +:s:`AssemblyOption` arguments in :s:`AsmArguments` and :s:`GlobalAsmArguments` +may be preceded by :t:`outer attribute` instances. + +:dp:`fls_nLBhw2w6uznH` +Only the :t:`attribute` :c:`cfg` and the :t:`attribute` :c:`cfg_attr` are +accepted on inline assembly arguments. All other attributes are rejected. + +:dp:`fls_xzDPz2zfRfoI` +If a :s:`AssemblyInstruction`, :s:`RegisterArgument`, :s:`AbiClobber`, or +:s:`AssemblyOption` is annotated with :c:`cfg` or :c:`cfg_attr` and the related +:t:`configuration predicate` evaluates to ``false``, the annotated argument has +no effect and is ignored. + +:dp:`fls_cTEiqjf6haEg` +It is a static error for a :s:`RegisterArgument`, :s:`AbiClobber`, or +:s:`AssemblyOption` to appear before the first :s:`AssemblyInstruction`, even if +the argument is ignored by :t:`conditional compilation`. + +.. rubric:: Examples + +.. code-block:: rust + + unsafe { + core::arch::asm!( + "nop", + #[cfg(target_feature = "sse2")] + "nop", + #[cfg(target_feature = "sse2")] + in(reg) 0_u32, + #[cfg(target_feature = "sse2")] + options(nomem, nostack), + ); + } + .. _fls_qezwyridmjob: Macros: asm, global_asm, and naked_asm @@ -1625,10 +1671,19 @@ Macros: asm, global_asm, and naked_asm .. syntax:: AsmArguments ::= - $$($$ AssemblyCodeBlock ($$,$$ LabelBlock)? ($$,$$ RegisterArgument)* ($$,$$ AbiClobber)* ($$,$$ AssemblyOption)* $$,$$? $$)$$ + $$($$ AssemblyCodeBlock ($$,$$ LabelBlock)? ($$,$$ AsmAttrRegisterArgument)* ($$,$$ AsmAttrAbiClobber)* ($$,$$ AsmAttrAssemblyOption)* $$,$$? $$)$$ GlobalAsmArguments ::= - $$($$ AssemblyCodeBlock ($$,$$ RegisterArgument)* ($$,$$ AssemblyOption)* $$,$$? $$)$$ + $$($$ AssemblyCodeBlock ($$,$$ AsmAttrRegisterArgument)* ($$,$$ AsmAttrAssemblyOption)* $$,$$? $$)$$ + + AsmAttrRegisterArgument ::= + OuterAttribute* RegisterArgument + + AsmAttrAbiClobber ::= + OuterAttribute* AbiClobber + + AsmAttrAssemblyOption ::= + OuterAttribute* AssemblyOption LabelBlock ::= $$block$$ $${$$ StatementList $$}$$ From 455f968f9401cdfbc48d208098acbbb52de67671 Mon Sep 17 00:00:00 2001 From: Pete LeVasseur Date: Sat, 31 Jan 2026 12:13:02 +0900 Subject: [PATCH 02/13] docs(inline-assembly): tie cfg-false behavior to conditional compilation --- src/inline-assembly.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/inline-assembly.rst b/src/inline-assembly.rst index 2861ca85..cf78d4ae 100644 --- a/src/inline-assembly.rst +++ b/src/inline-assembly.rst @@ -1637,8 +1637,9 @@ accepted on inline assembly arguments. All other attributes are rejected. :dp:`fls_xzDPz2zfRfoI` If a :s:`AssemblyInstruction`, :s:`RegisterArgument`, :s:`AbiClobber`, or :s:`AssemblyOption` is annotated with :c:`cfg` or :c:`cfg_attr` and the related -:t:`configuration predicate` evaluates to ``false``, the annotated argument has -no effect and is ignored. +:t:`configuration predicate` evaluates to ``false``, the annotated argument is +not considered part of the related macro invocation, consistent with +:t:`conditional compilation`. :dp:`fls_cTEiqjf6haEg` It is a static error for a :s:`RegisterArgument`, :s:`AbiClobber`, or From 537c500f7ee377935b2d374f1216f3541c71baaf Mon Sep 17 00:00:00 2001 From: Pete LeVasseur Date: Sat, 31 Jan 2026 13:41:47 +0900 Subject: [PATCH 03/13] docs(inline-assembly): use glossary terms in legality rules --- src/inline-assembly.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/inline-assembly.rst b/src/inline-assembly.rst index cf78d4ae..790ac581 100644 --- a/src/inline-assembly.rst +++ b/src/inline-assembly.rst @@ -1626,25 +1626,25 @@ Attributes .. rubric:: Legality Rules :dp:`fls_m0SBtonaNppV` -The :s:`AssemblyInstruction`, :s:`RegisterArgument`, :s:`AbiClobber`, and -:s:`AssemblyOption` arguments in :s:`AsmArguments` and :s:`GlobalAsmArguments` -may be preceded by :t:`outer attribute` instances. +The :t:`[assembly instruction]s`, :t:`[register argument]s`, +:t:`[ABI clobber]s`, and :t:`[assembly option]s` in :s:`AsmArguments` and +:s:`GlobalAsmArguments` may be preceded by :t:`outer attribute` instances. :dp:`fls_nLBhw2w6uznH` Only the :t:`attribute` :c:`cfg` and the :t:`attribute` :c:`cfg_attr` are accepted on inline assembly arguments. All other attributes are rejected. :dp:`fls_xzDPz2zfRfoI` -If a :s:`AssemblyInstruction`, :s:`RegisterArgument`, :s:`AbiClobber`, or -:s:`AssemblyOption` is annotated with :c:`cfg` or :c:`cfg_attr` and the related +If a :t:`assembly instruction`, :t:`register argument`, :t:`ABI clobber`, or +:t:`assembly option` is annotated with :c:`cfg` or :c:`cfg_attr` and the related :t:`configuration predicate` evaluates to ``false``, the annotated argument is not considered part of the related macro invocation, consistent with :t:`conditional compilation`. :dp:`fls_cTEiqjf6haEg` -It is a static error for a :s:`RegisterArgument`, :s:`AbiClobber`, or -:s:`AssemblyOption` to appear before the first :s:`AssemblyInstruction`, even if -the argument is ignored by :t:`conditional compilation`. +It is a static error for a :t:`register argument`, :t:`ABI clobber`, or +:t:`assembly option` to appear before the first :t:`assembly instruction`, even +if the argument is ignored by :t:`conditional compilation`. .. rubric:: Examples From f8546d46c7709f73f0fafc8de041e68e12ae5191 Mon Sep 17 00:00:00 2001 From: Pete LeVasseur Date: Sat, 31 Jan 2026 14:20:38 +0900 Subject: [PATCH 04/13] docs(inline-assembly): move attribute rules under macros --- src/inline-assembly.rst | 79 ++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 44 deletions(-) diff --git a/src/inline-assembly.rst b/src/inline-assembly.rst index 790ac581..7eed7d44 100644 --- a/src/inline-assembly.rst +++ b/src/inline-assembly.rst @@ -1618,50 +1618,6 @@ It is undefined behavior if control reaches the end of an options(nomem, pure) -.. _fls_tWub9IMeq68B: - -Attributes ----------- - -.. rubric:: Legality Rules - -:dp:`fls_m0SBtonaNppV` -The :t:`[assembly instruction]s`, :t:`[register argument]s`, -:t:`[ABI clobber]s`, and :t:`[assembly option]s` in :s:`AsmArguments` and -:s:`GlobalAsmArguments` may be preceded by :t:`outer attribute` instances. - -:dp:`fls_nLBhw2w6uznH` -Only the :t:`attribute` :c:`cfg` and the :t:`attribute` :c:`cfg_attr` are -accepted on inline assembly arguments. All other attributes are rejected. - -:dp:`fls_xzDPz2zfRfoI` -If a :t:`assembly instruction`, :t:`register argument`, :t:`ABI clobber`, or -:t:`assembly option` is annotated with :c:`cfg` or :c:`cfg_attr` and the related -:t:`configuration predicate` evaluates to ``false``, the annotated argument is -not considered part of the related macro invocation, consistent with -:t:`conditional compilation`. - -:dp:`fls_cTEiqjf6haEg` -It is a static error for a :t:`register argument`, :t:`ABI clobber`, or -:t:`assembly option` to appear before the first :t:`assembly instruction`, even -if the argument is ignored by :t:`conditional compilation`. - -.. rubric:: Examples - -.. code-block:: rust - - unsafe { - core::arch::asm!( - "nop", - #[cfg(target_feature = "sse2")] - "nop", - #[cfg(target_feature = "sse2")] - in(reg) 0_u32, - #[cfg(target_feature = "sse2")] - options(nomem, nostack), - ); - } - .. _fls_qezwyridmjob: Macros: asm, global_asm, and naked_asm @@ -1697,6 +1653,27 @@ Macros: asm, global_asm, and naked_asm :std:`core::arch::global_asm`, and :std:`core::arch::naked_asm`. +:dp:`fls_m0SBtonaNppV` +The :t:`[assembly instruction]s`, :t:`[register argument]s`, +:t:`[ABI clobber]s`, and :t:`[assembly option]s` in :s:`AsmArguments` and +:s:`GlobalAsmArguments` may be preceded by :t:`outer attribute` instances. + +:dp:`fls_nLBhw2w6uznH` +Only the :t:`attribute` :c:`cfg` and the :t:`attribute` :c:`cfg_attr` are +accepted on inline assembly arguments. All other attributes are rejected. + +:dp:`fls_xzDPz2zfRfoI` +If a :t:`assembly instruction`, :t:`register argument`, :t:`ABI clobber`, or +:t:`assembly option` is annotated with :c:`cfg` or :c:`cfg_attr` and the related +:t:`configuration predicate` evaluates to ``false``, the annotated argument is +not considered part of the related macro invocation, consistent with +:t:`conditional compilation`. + +:dp:`fls_cTEiqjf6haEg` +It is a static error for a :t:`register argument`, :t:`ABI clobber`, or +:t:`assembly option` to appear before the first :t:`assembly instruction`, even +if the argument is ignored by :t:`conditional compilation`. + :dp:`fls_1ikzov7cxic1` When invoking :t:`macro` :std:`core::arch::asm`, the :s:`DelimitedTokenTree` of the related :t:`macro invocation` shall follow the syntax of :s:`AsmArguments`. @@ -1754,6 +1731,20 @@ The :t:`execution` of an :t:`assembly code block` produced by .. rubric:: Examples +.. code-block:: rust + + unsafe { + core::arch::asm!( + "nop", + #[cfg(target_feature = "sse2")] + "nop", + #[cfg(target_feature = "sse2")] + in(reg) 0_u32, + #[cfg(target_feature = "sse2")] + options(nomem, nostack), + ); + } + .. code-block:: rust fn asm_example() -> u32 { From 8cb865d7bca205da65795d8e2eb716bfe31f5849 Mon Sep 17 00:00:00 2001 From: Pete LeVasseur Date: Sat, 31 Jan 2026 14:39:44 +0900 Subject: [PATCH 05/13] docs(inline-assembly): avoid line-wrapped legality paragraphs --- src/inline-assembly.rst | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/inline-assembly.rst b/src/inline-assembly.rst index 7eed7d44..3c0f0c7f 100644 --- a/src/inline-assembly.rst +++ b/src/inline-assembly.rst @@ -1654,25 +1654,16 @@ Macros: asm, global_asm, and naked_asm :std:`core::arch::naked_asm`. :dp:`fls_m0SBtonaNppV` -The :t:`[assembly instruction]s`, :t:`[register argument]s`, -:t:`[ABI clobber]s`, and :t:`[assembly option]s` in :s:`AsmArguments` and -:s:`GlobalAsmArguments` may be preceded by :t:`outer attribute` instances. +The :t:`[assembly instruction]s`, :t:`[register argument]s`, :t:`[ABI clobber]s`, and :t:`[assembly option]s` in :s:`AsmArguments` and :s:`GlobalAsmArguments` may be preceded by :t:`outer attribute` instances. :dp:`fls_nLBhw2w6uznH` -Only the :t:`attribute` :c:`cfg` and the :t:`attribute` :c:`cfg_attr` are -accepted on inline assembly arguments. All other attributes are rejected. +Only the :t:`attribute` :c:`cfg` and the :t:`attribute` :c:`cfg_attr` are accepted on inline assembly arguments. All other attributes are rejected. :dp:`fls_xzDPz2zfRfoI` -If a :t:`assembly instruction`, :t:`register argument`, :t:`ABI clobber`, or -:t:`assembly option` is annotated with :c:`cfg` or :c:`cfg_attr` and the related -:t:`configuration predicate` evaluates to ``false``, the annotated argument is -not considered part of the related macro invocation, consistent with -:t:`conditional compilation`. +If a :t:`assembly instruction`, :t:`register argument`, :t:`ABI clobber`, or :t:`assembly option` is annotated with :c:`cfg` or :c:`cfg_attr` and the related :t:`configuration predicate` evaluates to ``false``, the annotated argument is not considered part of the related macro invocation, consistent with :t:`conditional compilation`. :dp:`fls_cTEiqjf6haEg` -It is a static error for a :t:`register argument`, :t:`ABI clobber`, or -:t:`assembly option` to appear before the first :t:`assembly instruction`, even -if the argument is ignored by :t:`conditional compilation`. +It is a static error for a :t:`register argument`, :t:`ABI clobber`, or :t:`assembly option` to appear before the first :t:`assembly instruction`, even if the argument is ignored by :t:`conditional compilation`. :dp:`fls_1ikzov7cxic1` When invoking :t:`macro` :std:`core::arch::asm`, the :s:`DelimitedTokenTree` of From da682f3e40110c09e06321fe0ee2a440d7c7c691 Mon Sep 17 00:00:00 2001 From: Pete LeVasseur Date: Sun, 1 Feb 2026 06:41:16 +0900 Subject: [PATCH 06/13] docs(inline-assembly): expand assembly attribute grammar names --- src/changelog.rst | 2 +- src/inline-assembly.rst | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/changelog.rst b/src/changelog.rst index 7a3c58a0..e6d0d848 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -37,7 +37,7 @@ Language changes in Rust 1.93.0 - `Stabilize asm_cfg `_ - Changed syntax: :s:`AssemblyCodeBlock`, :s:`AsmArguments`, :s:`GlobalAsmArguments` - - New syntax: :s:`AsmTemplate`, :s:`AsmAttrRegisterArgument`, :s:`AsmAttrAbiClobber`, :s:`AsmAttrAssemblyOption` + - New syntax: :s:`AssemblyTemplate`, :s:`AssemblyAttributeRegisterArgument`, :s:`AssemblyAttributeAbiClobber`, :s:`AssemblyAttributeAssemblyOption` - New paragraphs: diff --git a/src/inline-assembly.rst b/src/inline-assembly.rst index 3c0f0c7f..4b09a4a3 100644 --- a/src/inline-assembly.rst +++ b/src/inline-assembly.rst @@ -963,9 +963,9 @@ Assembly Instructions .. syntax:: AssemblyCodeBlock ::= - AsmTemplate ($$,$$ AsmTemplate)* + AssemblyTemplate ($$,$$ AssemblyTemplate)* - AsmTemplate ::= + AssemblyTemplate ::= OuterAttribute* AssemblyInstruction AssemblyInstruction ::= @@ -1628,18 +1628,18 @@ Macros: asm, global_asm, and naked_asm .. syntax:: AsmArguments ::= - $$($$ AssemblyCodeBlock ($$,$$ LabelBlock)? ($$,$$ AsmAttrRegisterArgument)* ($$,$$ AsmAttrAbiClobber)* ($$,$$ AsmAttrAssemblyOption)* $$,$$? $$)$$ + $$($$ AssemblyCodeBlock ($$,$$ LabelBlock)? ($$,$$ AssemblyAttributeRegisterArgument)* ($$,$$ AssemblyAttributeAbiClobber)* ($$,$$ AssemblyAttributeAssemblyOption)* $$,$$? $$)$$ GlobalAsmArguments ::= - $$($$ AssemblyCodeBlock ($$,$$ AsmAttrRegisterArgument)* ($$,$$ AsmAttrAssemblyOption)* $$,$$? $$)$$ + $$($$ AssemblyCodeBlock ($$,$$ AssemblyAttributeRegisterArgument)* ($$,$$ AssemblyAttributeAssemblyOption)* $$,$$? $$)$$ - AsmAttrRegisterArgument ::= + AssemblyAttributeRegisterArgument ::= OuterAttribute* RegisterArgument - AsmAttrAbiClobber ::= + AssemblyAttributeAbiClobber ::= OuterAttribute* AbiClobber - AsmAttrAssemblyOption ::= + AssemblyAttributeAssemblyOption ::= OuterAttribute* AssemblyOption LabelBlock ::= From 2316b46a569fce5da06868ec76155b1519416820 Mon Sep 17 00:00:00 2001 From: Pete LeVasseur Date: Fri, 6 Mar 2026 11:54:09 +0900 Subject: [PATCH 07/13] docs(inline-assembly): remove redundant asm attribute optionality paragraph --- src/changelog.rst | 1 - src/inline-assembly.rst | 3 --- 2 files changed, 4 deletions(-) diff --git a/src/changelog.rst b/src/changelog.rst index e6d0d848..3c86710d 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -41,7 +41,6 @@ Language changes in Rust 1.93.0 - New paragraphs: - - :p:`fls_m0SBtonaNppV` - :p:`fls_nLBhw2w6uznH` - :p:`fls_xzDPz2zfRfoI` - :p:`fls_cTEiqjf6haEg` diff --git a/src/inline-assembly.rst b/src/inline-assembly.rst index 4b09a4a3..7e52cc93 100644 --- a/src/inline-assembly.rst +++ b/src/inline-assembly.rst @@ -1653,9 +1653,6 @@ Macros: asm, global_asm, and naked_asm :std:`core::arch::global_asm`, and :std:`core::arch::naked_asm`. -:dp:`fls_m0SBtonaNppV` -The :t:`[assembly instruction]s`, :t:`[register argument]s`, :t:`[ABI clobber]s`, and :t:`[assembly option]s` in :s:`AsmArguments` and :s:`GlobalAsmArguments` may be preceded by :t:`outer attribute` instances. - :dp:`fls_nLBhw2w6uznH` Only the :t:`attribute` :c:`cfg` and the :t:`attribute` :c:`cfg_attr` are accepted on inline assembly arguments. All other attributes are rejected. From 8b5d08177f6bd28ffa8364a008081f735f17cec4 Mon Sep 17 00:00:00 2001 From: Pete LeVasseur Date: Fri, 6 Mar 2026 11:54:42 +0900 Subject: [PATCH 08/13] docs(inline-assembly): make asm attribute allowlist normative --- src/inline-assembly.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inline-assembly.rst b/src/inline-assembly.rst index 7e52cc93..8790fdb1 100644 --- a/src/inline-assembly.rst +++ b/src/inline-assembly.rst @@ -1654,7 +1654,7 @@ Macros: asm, global_asm, and naked_asm :std:`core::arch::naked_asm`. :dp:`fls_nLBhw2w6uznH` -Only the :t:`attribute` :c:`cfg` and the :t:`attribute` :c:`cfg_attr` are accepted on inline assembly arguments. All other attributes are rejected. +Only :t:`attribute` :c:`cfg` and :t:`attribute` :c:`cfg_attr` shall decorate :t:`[assembly instruction]s`, :t:`[register argument]s`, :t:`[ABI clobber]s`, and :t:`[assembly option]s` in :s:`AsmArguments` and :s:`GlobalAsmArguments`; all other :t:`[attribute]s` shall be rejected. :dp:`fls_xzDPz2zfRfoI` If a :t:`assembly instruction`, :t:`register argument`, :t:`ABI clobber`, or :t:`assembly option` is annotated with :c:`cfg` or :c:`cfg_attr` and the related :t:`configuration predicate` evaluates to ``false``, the annotated argument is not considered part of the related macro invocation, consistent with :t:`conditional compilation`. From 788e41c5d90e0ee18ec78047ca73a6343e16dedf Mon Sep 17 00:00:00 2001 From: Pete LeVasseur Date: Fri, 6 Mar 2026 11:55:09 +0900 Subject: [PATCH 09/13] docs(inline-assembly): clarify cfg-false asm argument exclusion --- src/inline-assembly.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inline-assembly.rst b/src/inline-assembly.rst index 8790fdb1..a657b935 100644 --- a/src/inline-assembly.rst +++ b/src/inline-assembly.rst @@ -1657,7 +1657,7 @@ Macros: asm, global_asm, and naked_asm Only :t:`attribute` :c:`cfg` and :t:`attribute` :c:`cfg_attr` shall decorate :t:`[assembly instruction]s`, :t:`[register argument]s`, :t:`[ABI clobber]s`, and :t:`[assembly option]s` in :s:`AsmArguments` and :s:`GlobalAsmArguments`; all other :t:`[attribute]s` shall be rejected. :dp:`fls_xzDPz2zfRfoI` -If a :t:`assembly instruction`, :t:`register argument`, :t:`ABI clobber`, or :t:`assembly option` is annotated with :c:`cfg` or :c:`cfg_attr` and the related :t:`configuration predicate` evaluates to ``false``, the annotated argument is not considered part of the related macro invocation, consistent with :t:`conditional compilation`. +If a :t:`assembly instruction`, :t:`register argument`, :t:`ABI clobber`, or :t:`assembly option` in :s:`AsmArguments` or :s:`GlobalAsmArguments` is subject to :t:`attribute` :c:`cfg` or :t:`attribute` :c:`cfg_attr` where the related :t:`configuration predicate` evaluates to ``false``, then that construct is not considered part of the related :s:`AsmArguments` or :s:`GlobalAsmArguments`, consistent with :t:`conditional compilation`. :dp:`fls_cTEiqjf6haEg` It is a static error for a :t:`register argument`, :t:`ABI clobber`, or :t:`assembly option` to appear before the first :t:`assembly instruction`, even if the argument is ignored by :t:`conditional compilation`. From 147dbb3cb61271b7376f56e88759036b641fc8c2 Mon Sep 17 00:00:00 2001 From: Pete LeVasseur Date: Fri, 6 Mar 2026 11:55:25 +0900 Subject: [PATCH 10/13] docs(inline-assembly): make template-first rule explicit under cfg --- src/inline-assembly.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inline-assembly.rst b/src/inline-assembly.rst index a657b935..878d3c16 100644 --- a/src/inline-assembly.rst +++ b/src/inline-assembly.rst @@ -1660,7 +1660,7 @@ Only :t:`attribute` :c:`cfg` and :t:`attribute` :c:`cfg_attr` shall decorate :t: If a :t:`assembly instruction`, :t:`register argument`, :t:`ABI clobber`, or :t:`assembly option` in :s:`AsmArguments` or :s:`GlobalAsmArguments` is subject to :t:`attribute` :c:`cfg` or :t:`attribute` :c:`cfg_attr` where the related :t:`configuration predicate` evaluates to ``false``, then that construct is not considered part of the related :s:`AsmArguments` or :s:`GlobalAsmArguments`, consistent with :t:`conditional compilation`. :dp:`fls_cTEiqjf6haEg` -It is a static error for a :t:`register argument`, :t:`ABI clobber`, or :t:`assembly option` to appear before the first :t:`assembly instruction`, even if the argument is ignored by :t:`conditional compilation`. +It is a static error for a :t:`register argument`, :t:`ABI clobber`, or :t:`assembly option` to appear before the first :t:`assembly instruction`, including when that construct is subject to :t:`attribute` :c:`cfg` or :t:`attribute` :c:`cfg_attr` where the related :t:`configuration predicate` evaluates to ``false``. :dp:`fls_1ikzov7cxic1` When invoking :t:`macro` :std:`core::arch::asm`, the :s:`DelimitedTokenTree` of From 554ac83bc13f19aa5b0f17399968774a66f3cf3c Mon Sep 17 00:00:00 2001 From: Pete LeVasseur Date: Sat, 7 Mar 2026 00:39:51 +0900 Subject: [PATCH 11/13] docs(glossary): define inline assembly argument --- src/changelog.rst | 2 ++ src/glossary.rst | 8 ++++++++ src/inline-assembly.rst | 3 +++ 3 files changed, 13 insertions(+) diff --git a/src/changelog.rst b/src/changelog.rst index 3c86710d..312d95a6 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -38,9 +38,11 @@ Language changes in Rust 1.93.0 - Changed syntax: :s:`AssemblyCodeBlock`, :s:`AsmArguments`, :s:`GlobalAsmArguments` - New syntax: :s:`AssemblyTemplate`, :s:`AssemblyAttributeRegisterArgument`, :s:`AssemblyAttributeAbiClobber`, :s:`AssemblyAttributeAssemblyOption` + - New glossary entry: :t:`inline assembly argument` - New paragraphs: + - :p:`fls_tKj18krZ1pSt` - :p:`fls_nLBhw2w6uznH` - :p:`fls_xzDPz2zfRfoI` - :p:`fls_cTEiqjf6haEg` diff --git a/src/glossary.rst b/src/glossary.rst index 50c7fcf4..ca8b05ed 100644 --- a/src/glossary.rst +++ b/src/glossary.rst @@ -3396,6 +3396,14 @@ inline assembly :dt:`Inline assembly` is hand-written assembly code that is integrated into a Rust program. +.. _fls_K1MwUj4jqd0F: + +inline assembly argument +^^^^^^^^^^^^^^^^^^^^^^^^ + +:dp:`fls_Q7qnUo0GskSV` +An :dt:`inline assembly argument` is either an :t:`assembly instruction`, a :t:`register argument`, an :t:`ABI clobber`, or an :t:`assembly option`. + .. _fls_c54lmkluwbwr: inline module diff --git a/src/inline-assembly.rst b/src/inline-assembly.rst index 878d3c16..88d3e99c 100644 --- a/src/inline-assembly.rst +++ b/src/inline-assembly.rst @@ -1653,6 +1653,9 @@ Macros: asm, global_asm, and naked_asm :std:`core::arch::global_asm`, and :std:`core::arch::naked_asm`. +:dp:`fls_tKj18krZ1pSt` +An :t:`inline assembly argument` is either an :t:`assembly instruction`, a :t:`register argument`, an :t:`ABI clobber`, or an :t:`assembly option`. + :dp:`fls_nLBhw2w6uznH` Only :t:`attribute` :c:`cfg` and :t:`attribute` :c:`cfg_attr` shall decorate :t:`[assembly instruction]s`, :t:`[register argument]s`, :t:`[ABI clobber]s`, and :t:`[assembly option]s` in :s:`AsmArguments` and :s:`GlobalAsmArguments`; all other :t:`[attribute]s` shall be rejected. From a6b595f61fdcb39f353f1a07cccdfb21a26f3635 Mon Sep 17 00:00:00 2001 From: Pete LeVasseur Date: Sat, 7 Mar 2026 00:40:15 +0900 Subject: [PATCH 12/13] docs(inline-assembly): simplify asm attribute rule --- src/inline-assembly.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inline-assembly.rst b/src/inline-assembly.rst index 88d3e99c..f3880a2a 100644 --- a/src/inline-assembly.rst +++ b/src/inline-assembly.rst @@ -1657,7 +1657,7 @@ Macros: asm, global_asm, and naked_asm An :t:`inline assembly argument` is either an :t:`assembly instruction`, a :t:`register argument`, an :t:`ABI clobber`, or an :t:`assembly option`. :dp:`fls_nLBhw2w6uznH` -Only :t:`attribute` :c:`cfg` and :t:`attribute` :c:`cfg_attr` shall decorate :t:`[assembly instruction]s`, :t:`[register argument]s`, :t:`[ABI clobber]s`, and :t:`[assembly option]s` in :s:`AsmArguments` and :s:`GlobalAsmArguments`; all other :t:`[attribute]s` shall be rejected. +Only :t:`attribute` :c:`cfg` and :t:`attribute` :c:`cfg_attr` shall decorate :t:`[inline assembly arguments]s` in :s:`AsmArguments` and :s:`GlobalAsmArguments`. :dp:`fls_xzDPz2zfRfoI` If a :t:`assembly instruction`, :t:`register argument`, :t:`ABI clobber`, or :t:`assembly option` in :s:`AsmArguments` or :s:`GlobalAsmArguments` is subject to :t:`attribute` :c:`cfg` or :t:`attribute` :c:`cfg_attr` where the related :t:`configuration predicate` evaluates to ``false``, then that construct is not considered part of the related :s:`AsmArguments` or :s:`GlobalAsmArguments`, consistent with :t:`conditional compilation`. From d1ea9494cbb5c3492f8f7009b037d4cc30552382 Mon Sep 17 00:00:00 2001 From: Pete LeVasseur Date: Sat, 7 Mar 2026 00:40:46 +0900 Subject: [PATCH 13/13] docs(inline-assembly): drop redundant asm cfg paragraph --- src/changelog.rst | 1 - src/inline-assembly.rst | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/changelog.rst b/src/changelog.rst index 312d95a6..9a6cbfc2 100644 --- a/src/changelog.rst +++ b/src/changelog.rst @@ -44,7 +44,6 @@ Language changes in Rust 1.93.0 - :p:`fls_tKj18krZ1pSt` - :p:`fls_nLBhw2w6uznH` - - :p:`fls_xzDPz2zfRfoI` - :p:`fls_cTEiqjf6haEg` - `During const-evaluation, support copying pointers byte-by-byte `_ diff --git a/src/inline-assembly.rst b/src/inline-assembly.rst index f3880a2a..b2ddc0fc 100644 --- a/src/inline-assembly.rst +++ b/src/inline-assembly.rst @@ -1659,11 +1659,8 @@ An :t:`inline assembly argument` is either an :t:`assembly instruction`, a :t:`r :dp:`fls_nLBhw2w6uznH` Only :t:`attribute` :c:`cfg` and :t:`attribute` :c:`cfg_attr` shall decorate :t:`[inline assembly arguments]s` in :s:`AsmArguments` and :s:`GlobalAsmArguments`. -:dp:`fls_xzDPz2zfRfoI` -If a :t:`assembly instruction`, :t:`register argument`, :t:`ABI clobber`, or :t:`assembly option` in :s:`AsmArguments` or :s:`GlobalAsmArguments` is subject to :t:`attribute` :c:`cfg` or :t:`attribute` :c:`cfg_attr` where the related :t:`configuration predicate` evaluates to ``false``, then that construct is not considered part of the related :s:`AsmArguments` or :s:`GlobalAsmArguments`, consistent with :t:`conditional compilation`. - :dp:`fls_cTEiqjf6haEg` -It is a static error for a :t:`register argument`, :t:`ABI clobber`, or :t:`assembly option` to appear before the first :t:`assembly instruction`, including when that construct is subject to :t:`attribute` :c:`cfg` or :t:`attribute` :c:`cfg_attr` where the related :t:`configuration predicate` evaluates to ``false``. +It is a static error for a :t:`register argument`, :t:`ABI clobber`, or :t:`assembly option` to appear before the first :t:`assembly instruction`, including when that :t:`inline assembly argument` is subject to :t:`attribute` :c:`cfg` or :t:`attribute` :c:`cfg_attr` where the related :t:`configuration predicate` evaluates to ``false``. :dp:`fls_1ikzov7cxic1` When invoking :t:`macro` :std:`core::arch::asm`, the :s:`DelimitedTokenTree` of