Skip to content

Commit 24137b4

Browse files
authored
Merge pull request rust-lang#712 from JustAPerson/patch-1
abi.md: clarify #[used] and linking
2 parents d8dfe1b + c198d98 commit 24137b4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/abi.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ linking external libraries.
1010
## The `used` attribute
1111

1212
The *`used` attribute* can only be applied to [`static` items]. This [attribute] forces the
13-
compiler to keep the variable in the output object file (.o, .rlib, etc.) even if the variable is
14-
not used, or referenced, by any other item in the crate.
13+
compiler to keep the variable in the output object file (.o, .rlib, etc. excluding final binaries)
14+
even if the variable is not used, or referenced, by any other item in the crate.
15+
However, the linker is still free to remove such an item.
1516

1617
Below is an example that shows under what conditions the compiler keeps a `static` item in the
1718
output object file.

0 commit comments

Comments
 (0)