Skip to content

Commit 83b85f4

Browse files
authored
Merge pull request rust-lang#161 from brauliobz/grammar_static_item
Static item grammar
2 parents e19ff6d + 55667f6 commit 83b85f4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/items/static-items.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Static items
22

3+
> **<sup>Syntax</sup>**
4+
> _StaticItem_ :
5+
> &nbsp;&nbsp; `static` `mut`<sup>?</sup> [IDENTIFIER] `:` [_Type_]
6+
> `=` [_Expression_] `;`
7+
38
A *static item* is similar to a *constant*, except that it represents a precise
49
memory location in the program. A static is never "inlined" at the usage site,
510
and all references to it refer to the same memory location. Static items have
@@ -106,3 +111,7 @@ const RESOLVED_MULTIPLE: Fn(&Foo, &Bar, &Baz) -> usize = ..
106111
// `Fn(&'static Foo, &'static Bar) -> &'static Baz`.
107112
const RESOLVED_STATIC: Fn(&Foo, &Bar) -> &Baz = ..
108113
```
114+
115+
[IDENTIFIER]: identifiers.html
116+
[_Type_]: types.html
117+
[_Expression_]: expressions.html

0 commit comments

Comments
 (0)