Skip to content

Update no_builtins to use the attribute template #1909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions src/attributes/codegen.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +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.

<!-- TODO: This needs expanding, see https://github.com/rust-lang/reference/issues/542 -->

> [!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
Expand Down