Skip to content

Commit 2b06733

Browse files
ehusstraviscross
authored andcommitted
Update no_builtins to use attribute template
1 parent 1228c7e commit 2b06733

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/attributes/codegen.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,27 @@ The [testing attributes](testing.md) cannot be applied to a naked function.
8585
r[attributes.codegen.no_builtins]
8686
## The `no_builtins` attribute
8787

88-
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.
88+
r[attributes.codegen.no_builtins.intro]
89+
The *`no_builtins` [attribute]* disables optimizing certain code patterns to invocations of library functions that are assumed to exist.
90+
91+
<!-- TODO: This needs expanding, see https://github.com/rust-lang/reference/issues/542 -->
92+
93+
> [!EXAMPLE]
94+
> ```rust
95+
> #![no_builtins]
96+
> ```
97+
98+
r[attributes.codegen.no_builtins.syntax]
99+
The `no_builtins` attribute uses the [MetaWord] syntax and thus does not take any inputs.
100+
101+
r[attributes.codegen.no_builtins.allowed-positions]
102+
The `no_builtins` attribute can only be applied to the crate root.
103+
104+
r[attributes.codegen.no_builtins.duplicates]
105+
Duplicate instances of the `no_builtins` attribute have no effect.
106+
107+
> [!NOTE]
108+
> `rustc` currently warns on subsequent duplicate `no_builtins` attributes.
89109
90110
r[attributes.codegen.target_feature]
91111
## The `target_feature` attribute

0 commit comments

Comments
 (0)