Skip to content

Commit bf5d208

Browse files
committed
---
yaml --- r: 93167 b: refs/heads/try c: b2b2095 h: refs/heads/master i: 93165: 923f3e3 93163: e4daa03 93159: cad7591 93151: 09a07bc v: v3
1 parent f604d17 commit bf5d208

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: 03111fb83b8c8c2c04939dfebb2fd3b9053aa462
5+
refs/heads/try: b2b2095eaf2e71b1b60797a96c097572928f001c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/doc/rust.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3395,16 +3395,23 @@ a [temporary](#lvalues-rvalues-and-temporaries), or a local variable.
33953395
A _local variable_ (or *stack-local* allocation) holds a value directly,
33963396
allocated within the stack's memory. The value is a part of the stack frame.
33973397

3398-
Local variables are immutable unless declared with `let mut`. The
3399-
`mut` keyword applies to all local variables declared within that
3400-
declaration (so `let mut (x, y) = ...` declares two mutable variables, `x` and
3401-
`y`).
3398+
Local variables are immutable unless declared otherwise like: `let mut x = ...`.
34023399

34033400
Function parameters are immutable unless declared with `mut`. The
34043401
`mut` keyword applies only to the following parameter (so `|mut x, y|`
34053402
and `fn f(mut x: ~int, y: ~int)` declare one mutable variable `x` and
34063403
one immutable variable `y`).
34073404

3405+
Methods that take either `self` or `~self` can optionally place them in a
3406+
mutable slot by prefixing them with `mut` (similar to regular arguments):
3407+
3408+
~~~
3409+
trait Changer {
3410+
fn change(mut self) -> Self;
3411+
fn modify(mut ~self) -> ~Self;
3412+
}
3413+
~~~
3414+
34083415
Local variables are not initialized when allocated; the entire frame worth of
34093416
local variables are allocated at once, on frame-entry, in an uninitialized
34103417
state. Subsequent statements within a function may or may not initialize the

0 commit comments

Comments
 (0)