Skip to content

Commit d95c314

Browse files
authored
Merge pull request #1626 from chorman0773/spec-add-identifiers-variables
Add identifiers to variables.md
2 parents db5dbd3 + 5a2e166 commit d95c314

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/variables.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
# Variables
22

3+
r[variable]
4+
5+
r[variable.intro]
36
A _variable_ is a component of a stack frame, either a named function parameter,
47
an anonymous [temporary](expressions.md#temporaries), or a named local
58
variable.
69

10+
r[variable.local]
711
A _local variable_ (or *stack-local* allocation) holds a value directly,
812
allocated within the stack's memory. The value is a part of the stack frame.
913

14+
r[variable.local-mut]
1015
Local variables are immutable unless declared otherwise. For example:
1116
`let mut x = ...`.
1217

18+
r[variable.param-mut]
1319
Function parameters are immutable unless declared with `mut`. The `mut` keyword
1420
applies only to the following parameter. For example: `|mut x, y|` and
1521
`fn f(mut x: Box<i32>, y: Box<i32>)` declare one mutable variable `x` and one
1622
immutable variable `y`.
1723

24+
r[variable.init]
1825
Local variables are not initialized when allocated. Instead, the entire frame
1926
worth of local variables are allocated, on frame-entry, in an uninitialized
2027
state. Subsequent statements within a function may or may not initialize the

0 commit comments

Comments
 (0)