@@ -6,23 +6,17 @@ wherever they are used, meaning that they are copied directly into the relevant
6
6
context when used. References to the same constant are not necessarily
7
7
guaranteed to refer to the same memory address.
8
8
9
- [ constant value ] : expressions.html#constant-expressions
10
-
11
9
Constant values must not have destructors, and otherwise permit most forms of
12
10
data. Constants may refer to the address of other constants, in which case the
13
11
address will have elided lifetimes where applicable, otherwise – in most cases
14
12
– defaulting to the ` static ` lifetime. (See below on [ static lifetime
15
13
elision] .) The compiler is, however, still at liberty to translate the constant
16
14
many times, so the address referred to may not be stable.
17
15
18
- [ static lifetime elision ] : items/static-items.html#static-lifetime-elision
19
-
20
16
Constants must be explicitly typed. The type may be any type that doesn't
21
17
implement [ ` Drop ` ] and has a ` 'static ` lifetime: any references it contains
22
18
must have ` 'static ` lifetimes.
23
19
24
- [ `Drop` ] : the-drop-trait.html
25
-
26
20
``` rust
27
21
const BIT1 : u32 = 1 << 0 ;
28
22
const BIT2 : u32 = 1 << 1 ;
@@ -40,3 +34,7 @@ const BITS_N_STRINGS: BitsNStrings<'static> = BitsNStrings {
40
34
mystring : STRING ,
41
35
};
42
36
```
37
+
38
+ [ constant value ] : expressions.html#constant-expressions
39
+ [ static lifetime elision ] : items/static-items.html#static-lifetime-elision
40
+ [ `Drop` ] : the-drop-trait.html
0 commit comments