@@ -617,8 +617,8 @@ each of which may have some number of [attributes](#attributes) attached to it.
617617## Items
618618
619619~~~~~~~~ {.ebnf .gram}
620- item : mod_item | fn_item | type_item | enum_item
621- | const_item | trait_item | impl_item | foreign_mod_item ;
620+ item : mod_item | fn_item | type_item | struct_item | enum_item
621+ | static_item | trait_item | impl_item | foreign_mod_item ;
622622~~~~~~~~
623623
624624An _ item_ is a component of a crate; some module items can be defined in crate
@@ -627,7 +627,7 @@ crate by a nested set of [modules](#modules). Every crate has a single
627627"outermost" anonymous module; all further items within the crate have
628628[ paths] ( #paths ) within the module tree of the crate.
629629
630- Items are entirely determined at compile-time, remain constant during
630+ Items are entirely determined at compile-time, generally remain fixed during
631631execution, and may reside in read-only memory.
632632
633633There are several kinds of item:
@@ -637,7 +637,7 @@ There are several kinds of item:
637637 * [ type definitions] ( #type-definitions )
638638 * [ structures] ( #structures )
639639 * [ enumerations] ( #enumerations )
640- * [ constants ] ( #constants )
640+ * [ static items ] ( #static-items )
641641 * [ traits] ( #traits )
642642 * [ implementations] ( #implementations )
643643
@@ -1091,21 +1091,23 @@ a = Cat{ name: ~"Spotty", weight: 2.7 };
10911091In this example, ` Cat ` is a _ struct-like enum variant_ ,
10921092whereas ` Dog ` is simply called an enum variant.
10931093
1094- ### Constants
1094+ ### Static items
10951095
10961096~~~~~~~~ {.ebnf .gram}
1097- const_item : "const " ident ':' type '=' expr ';' ;
1097+ static_item : "static " ident ':' type '=' expr ';' ;
10981098~~~~~~~~
10991099
1100- A * constant* is a named value stored in read-only memory in a crate.
1101- The value bound to a constant is evaluated at compile time.
1102- Constants are declared with the ` static ` keyword.
1103- A constant item must have an expression giving its definition.
1104- The definition expression of a constant is limited to expression forms that can be evaluated at compile time.
1100+ A * static item* is a named _ constant value_ stored in the global data section of a crate.
1101+ Immutable static items are stored in the read-only data section.
1102+ The constant value bound to a static item is, like all constant values, evaluated at compile time.
1103+ Static items have the ` static ` lifetime, which outlives all other lifetimes in a Rust program.
1104+ Static items are declared with the ` static ` keyword.
1105+ A static item must have a _ constant expression_ giving its definition.
11051106
1106- Constants must be explicitly typed. The type may be ``` bool ``` , ``` char ``` , a number, or a type derived from those primitive types.
1107- The derived types are borrowed pointers, static arrays, tuples, and structs.
1108- Borrowed pointers must be have the ` 'static ` lifetime.
1107+ Static items must be explicitly typed.
1108+ The type may be ``` bool ``` , ``` char ``` , a number, or a type derived from those primitive types.
1109+ The derived types are borrowed pointers with the ` 'static ` lifetime,
1110+ fixed-size arrays, tuples, and structs.
11091111
11101112~~~~
11111113static bit1: uint = 1 << 0;
@@ -1456,7 +1458,7 @@ The declared names may denote new slots or new items.
14561458
14571459An _ item declaration statement_ has a syntactic form identical to an
14581460[ item] ( #items ) declaration within a module. Declaring an item -- a function,
1459- enumeration, type, constant , trait, implementation or module -- locally
1461+ enumeration, structure, type, static , trait, implementation or module -- locally
14601462within a statement block is simply a way of restricting its scope to a narrow
14611463region containing all of its uses; it is otherwise identical in meaning to
14621464declaring the item outside the statement block.
0 commit comments