Skip to content

Commit 20c4f28

Browse files
committed
Wordsmith text for unsafe attributes
In this commit, we improve some verbiage.
1 parent 2bd4470 commit 20c4f28

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/abi.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,17 @@ item's name.
6666
Additionally, the item will be publicly exported from the produced library or
6767
object file, similar to the [`used` attribute](#the-used-attribute).
6868

69-
This attribute is unsafe as an unmangled symbol may collide with another
70-
symbol with the same name (or a well-known symbol), leading to undefined behavior.
69+
This attribute is unsafe as an unmangled symbol may collide with another symbol
70+
with the same name (or with a well-known symbol), leading to undefined behavior.
7171

7272
## The `link_section` attribute
7373

7474
The *`link_section` attribute* specifies the section of the object file that a
7575
[function] or [static]'s content will be placed into. It uses the
7676
[_MetaNameValueStr_] syntax to specify the section name.
7777

78-
This attribute is unsafe as using `link_section` allows users to place data
79-
and code into sections of memory not expecting them, such as mutable data
80-
into read-only areas.
78+
This attribute is unsafe as it allows users to place data and code into sections
79+
of memory not expecting them, such as mutable data into read-only areas.
8180

8281
<!-- no_run: don't link. The format of the section name is platform-specific. -->
8382
```rust,no_run
@@ -93,7 +92,8 @@ exported on a [function] or [static]. It uses the [_MetaNameValueStr_] syntax
9392
to specify the symbol name.
9493

9594
This attribute is unsafe as a symbol with a custom name may collide with another
96-
symbol with the same name (or a well-known symbol), leading to undefined behavior.
95+
symbol with the same name (or with a well-known symbol), leading to undefined
96+
behavior.
9797

9898
```rust
9999
#[export_name = "exported_symbol_name"]

src/attributes.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ Attributes other than macro attributes also allow the input to be an equals
3333
sign (`=`) followed by an expression. See the [meta item
3434
syntax](#meta-item-attribute-syntax) below for more details.
3535

36-
An attribute may be considered unsafe. Unsafe attributes must *satisfy* extra
37-
safety conditions that cannot be checked by the compiler, and are specified
38-
as the attribute wrapped in `unsafe(...)`, for instance, `#[unsafe(no_mangle)]`.
36+
An attribute may be unsafe to apply. To avoid undefined behavior when using
37+
these attributes, certain obligations that cannot be checked by the compiler
38+
must be met. To assert these have been, the attribute is wrapped in
39+
`unsafe(..)`, e.g. `#[unsafe(no_mangle)]`.
3940

4041
The following attributes are unsafe:
4142

0 commit comments

Comments
 (0)