@@ -9,25 +9,25 @@ linking external libraries.
9
9
10
10
## The ` used ` attribute
11
11
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
13
13
compiler to keep the variable in the output object file (.o, .rlib, etc.) even if the variable is
14
14
not used, or referenced, by any other item in the crate.
15
15
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
17
17
output object file.
18
18
19
19
``` rust
20
20
// foo.rs
21
21
22
- // kept because of #[used]
22
+ // This is kept because of ` #[used]`:
23
23
#[used]
24
24
static FOO : u32 = 0 ;
25
25
26
- // removable because it is unused
26
+ // This is removable because it is unused:
27
27
#[allow(dead_code)]
28
28
static BAR : u32 = 0 ;
29
29
30
- // kept because it is referenced by a public, reachable function
30
+ // This is kept because it is referenced by a public, reachable function:
31
31
pub static BAZ : u32 = 0 ;
32
32
33
33
static QUUX : u32 = 0 ;
@@ -36,7 +36,7 @@ pub fn quux() -> &'static u32 {
36
36
& QUUX
37
37
}
38
38
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:
40
40
static CORGE : u32 = 0 ;
41
41
42
42
#[allow(dead_code)]
@@ -55,7 +55,7 @@ $ nm -C foo.o
55
55
0000000000000000 T foo::quux
56
56
```
57
57
58
- [ `static` variables ] : items/static-items.html
58
+ [ `static` items ] : items/static-items.html
59
59
[ attribute ] : attributes.html
60
60
[ extern functions ] : items/functions.html#extern-functions
61
61
[ external blocks ] : items/external-blocks.html
0 commit comments