Skip to content

Commit a2f10c4

Browse files
committed
Update for centril's review.
1 parent 9fd5b4d commit a2f10c4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/abi.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ linking external libraries.
99

1010
## The `used` attribute
1111

12-
The *`used` attribute* can only be applied to [`static` variables]. This [attribute] forces the
12+
The *`used` attribute* can only be applied to [`static` items]. This [attribute] forces the
1313
compiler to keep the variable in the output object file (.o, .rlib, etc.) even if the variable is
1414
not used, or referenced, by any other item in the crate.
1515

16-
Below is an example that shows under what conditions the compiler keeps a `static` variable in the
16+
Below is an example that shows under what conditions the compiler keeps a `static` item in the
1717
output object file.
1818

1919
``` rust
2020
// foo.rs
2121

22-
// kept because of #[used]
22+
// This is kept because of `#[used]`:
2323
#[used]
2424
static FOO: u32 = 0;
2525

26-
// removable because it is unused
26+
// This is removable because it is unused:
2727
#[allow(dead_code)]
2828
static BAR: u32 = 0;
2929

30-
// kept because it is referenced by a public, reachable function
30+
// This is kept because it is referenced by a public, reachable function:
3131
pub static BAZ: u32 = 0;
3232

3333
static QUUX: u32 = 0;
@@ -36,7 +36,7 @@ pub fn quux() -> &'static u32 {
3636
&QUUX
3737
}
3838

39-
// removable because it is referenced by a private, unused (dead) function
39+
// This is removable because it is referenced by a private, unused (dead) function:
4040
static CORGE: u32 = 0;
4141

4242
#[allow(dead_code)]
@@ -55,7 +55,7 @@ $ nm -C foo.o
5555
0000000000000000 T foo::quux
5656
```
5757

58-
[`static` variables]: items/static-items.html
58+
[`static` items]: items/static-items.html
5959
[attribute]: attributes.html
6060
[extern functions]: items/functions.html#extern-functions
6161
[external blocks]: items/external-blocks.html

src/attributes.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ which can be used to control type layout.
204204
object file that this item's contents will be placed into.
205205
- `no_mangle` - on any item, do not apply the standard name mangling. Set the
206206
symbol for this item to its identifier.
207-
- `used` - on statics, this forces the compiler to keep the variable in the
207+
- [`used`] - on statics, this forces the compiler to keep the variable in the
208208
output object file.
209209

210210
### Deprecation
@@ -631,3 +631,4 @@ pub fn f() {}
631631
[trait or lifetime bounds]: trait-bounds.html
632632
[Expression Attributes]: expressions.html#expression-attributes
633633
[`meta` macro fragment specifier]: macros-by-example.html
634+
[`used`]: abi.html#the-used-attribute

0 commit comments

Comments
 (0)