Skip to content

Commit c379d96

Browse files
committed
doc: Document mutable function arguments
1 parent 54344c2 commit c379d96

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

doc/rust.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3018,6 +3018,11 @@ Local variables are immutable unless declared with `let mut`. The
30183018
declaration (so `let mut x, y` declares two mutable variables, `x` and
30193019
`y`).
30203020

3021+
Function parameters are immutable unless declared with `mut`. The
3022+
`mut` keyword applies only to the following parameter (so `|mut x, y|`
3023+
and `fn f(mut x: ~int, y: ~int)` declare one mutable variable `x` and
3024+
one immutable variable `y`).
3025+
30213026
Local variables are not initialized when allocated; the entire frame worth of
30223027
local variables are allocated at once, on frame-entry, in an uninitialized
30233028
state. Subsequent statements within a function may or may not initialize the

0 commit comments

Comments
 (0)