From 1228c7e310ca75938a1c8fa0ac26bb317ce8b5cf Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 2 Jun 2025 19:06:00 -0700 Subject: [PATCH 1/3] Unwrap no_builtins --- src/attributes/codegen.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/attributes/codegen.md b/src/attributes/codegen.md index cf9837d9e9..8a3e9d0aaa 100644 --- a/src/attributes/codegen.md +++ b/src/attributes/codegen.md @@ -85,9 +85,7 @@ The [testing attributes](testing.md) cannot be applied to a naked function. r[attributes.codegen.no_builtins] ## The `no_builtins` attribute -The *`no_builtins` [attribute]* may be applied at the crate level to disable -optimizing certain code patterns to invocations of library functions that are -assumed to exist. +The *`no_builtins` [attribute]* may be applied at the crate level to disable optimizing certain code patterns to invocations of library functions that are assumed to exist. r[attributes.codegen.target_feature] ## The `target_feature` attribute From 2b06733039dd70533176a6c094e5bdc1ae0ed2a0 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 2 Jun 2025 19:09:24 -0700 Subject: [PATCH 2/3] Update no_builtins to use attribute template --- src/attributes/codegen.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/attributes/codegen.md b/src/attributes/codegen.md index 8a3e9d0aaa..5ca8b0f57b 100644 --- a/src/attributes/codegen.md +++ b/src/attributes/codegen.md @@ -85,7 +85,27 @@ The [testing attributes](testing.md) cannot be applied to a naked function. r[attributes.codegen.no_builtins] ## The `no_builtins` attribute -The *`no_builtins` [attribute]* may be applied at the crate level to disable optimizing certain code patterns to invocations of library functions that are assumed to exist. +r[attributes.codegen.no_builtins.intro] +The *`no_builtins` [attribute]* disables optimizing certain code patterns to invocations of library functions that are assumed to exist. + + + +> [!EXAMPLE] +> ```rust +> #![no_builtins] +> ``` + +r[attributes.codegen.no_builtins.syntax] +The `no_builtins` attribute uses the [MetaWord] syntax and thus does not take any inputs. + +r[attributes.codegen.no_builtins.allowed-positions] +The `no_builtins` attribute can only be applied to the crate root. + +r[attributes.codegen.no_builtins.duplicates] +Duplicate instances of the `no_builtins` attribute have no effect. + +> [!NOTE] +> `rustc` currently warns on subsequent duplicate `no_builtins` attributes. r[attributes.codegen.target_feature] ## The `target_feature` attribute From d42abcd71ccc8d9ac8b12e7581c71cf9f4868197 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 10 Aug 2025 14:51:40 +0000 Subject: [PATCH 3/3] Revise `no_builtins` text --- src/attributes/codegen.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/attributes/codegen.md b/src/attributes/codegen.md index 5ca8b0f57b..3d2862448c 100644 --- a/src/attributes/codegen.md +++ b/src/attributes/codegen.md @@ -86,9 +86,9 @@ r[attributes.codegen.no_builtins] ## The `no_builtins` attribute r[attributes.codegen.no_builtins.intro] -The *`no_builtins` [attribute]* disables optimizing certain code patterns to invocations of library functions that are assumed to exist. +The *`no_builtins` [attribute]* disables optimization of certain code patterns related to calls to library functions that are assumed to exist. - + > [!EXAMPLE] > ```rust @@ -96,16 +96,16 @@ The *`no_builtins` [attribute]* disables optimizing certain code patterns to inv > ``` r[attributes.codegen.no_builtins.syntax] -The `no_builtins` attribute uses the [MetaWord] syntax and thus does not take any inputs. +The `no_builtins` attribute uses the [MetaWord] syntax. r[attributes.codegen.no_builtins.allowed-positions] The `no_builtins` attribute can only be applied to the crate root. r[attributes.codegen.no_builtins.duplicates] -Duplicate instances of the `no_builtins` attribute have no effect. +Only the first use of the `no_builtins` attribute has effect. > [!NOTE] -> `rustc` currently warns on subsequent duplicate `no_builtins` attributes. +> `rustc` currently lints against uses following the first. r[attributes.codegen.target_feature] ## The `target_feature` attribute