@@ -706,7 +706,7 @@ There are several kinds of item:
706
706
* [ functions] ( #functions )
707
707
* [ type definitions] ( #type-definitions )
708
708
* [ enumerations] ( #enumerations )
709
- * [ resources ] ( #resources )
709
+ * [ constants ] ( #constants )
710
710
* [ traits] ( #traits )
711
711
* [ implementations] ( #implementations )
712
712
@@ -1151,6 +1151,18 @@ enum list<T> {
1151
1151
let a: list<int> = cons(7, @cons(13, @nil));
1152
1152
~~~~
1153
1153
1154
+ ### Constants
1155
+
1156
+ ~~~~~~~~ {.ebnf .gram}
1157
+ const_item : "const" ident ':' type '=' expr ';' ;
1158
+ ~~~~~~~~
1159
+
1160
+ A Constant is a named value stored in read-only memory in a crate.
1161
+ The value bound to a constant is evaluated at compile time.
1162
+ Constants are declared with the ` const ` keyword.
1163
+ A constant item must have an expression giving its definition.
1164
+ The definition expression of a constant is limited to expression forms that can be evaluated at compile time.
1165
+
1154
1166
### Traits
1155
1167
1156
1168
A _ trait item_ describes a set of method types. [ _ implementation
@@ -1425,7 +1437,7 @@ statement block. The declared name may denote a new slot or a new item.
1425
1437
1426
1438
An _ item declaration statement_ has a syntactic form identical to an
1427
1439
[ item] ( #items ) declaration within a module. Declaring an item -- a function,
1428
- enumeration, type, resource , trait, implementation or module -- locally
1440
+ enumeration, type, constant , trait, implementation or module -- locally
1429
1441
within a statement block is simply a way of restricting its scope to a narrow
1430
1442
region containing all of its uses; it is otherwise identical in meaning to
1431
1443
declaring the item outside the statement block.
@@ -1629,8 +1641,7 @@ operators, before the expression they apply to.
1629
1641
` - `
1630
1642
: Negation. May only be applied to numeric types.
1631
1643
` * `
1632
- : Dereference. When applied to a [ box] ( #box-types ) or
1633
- [ resource] ( #resources ) type, it accesses the inner value. For
1644
+ : Dereference. When applied to a [ pointer] ( #pointer-types ) it denotes the pointed-to location. For
1634
1645
mutable boxes, the resulting [ lvalue] ( #lvalues-rvalues-and-temporaries ) can be assigned to. For
1635
1646
[ enums] ( #enumerated-types ) that have only a single variant,
1636
1647
containing a single parameter, the dereference operator accesses
@@ -2185,7 +2196,7 @@ fail_expr : "fail" expr ? ;
2185
2196
2186
2197
Evaluating a ` fail ` expression causes a task to enter the * failing* state. In
2187
2198
the * failing* state, a task unwinds its stack, destroying all frames and
2188
- freeing all resources until it reaches its entry frame, at which point it
2199
+ running all destructors until it reaches its entry frame, at which point it
2189
2200
halts execution in the * dead* state.
2190
2201
2191
2202
0 commit comments