@@ -3168,7 +3168,7 @@ Raw pointers (`*`)
3168
3168
: Raw pointers are pointers without safety or liveness guarantees.
3169
3169
Raw pointers are written ` *content ` ,
3170
3170
for example ` *int ` means a raw pointer to an integer.
3171
- Copying or dropping a raw pointer is has no effect on the lifecycle of any other value.
3171
+ Copying or dropping a raw pointer has no effect on the lifecycle of any other value.
3172
3172
Dereferencing a raw pointer or converting it to any other pointer type is an [ ` unsafe ` operation] ( #unsafe-functions ) .
3173
3173
Raw pointers are generally discouraged in Rust code;
3174
3174
they exist to support interoperability with foreign code,
@@ -3395,16 +3395,23 @@ a [temporary](#lvalues-rvalues-and-temporaries), or a local variable.
3395
3395
A _ local variable_ (or * stack-local* allocation) holds a value directly,
3396
3396
allocated within the stack's memory. The value is a part of the stack frame.
3397
3397
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 = ... ` .
3402
3399
3403
3400
Function parameters are immutable unless declared with ` mut ` . The
3404
3401
` mut ` keyword applies only to the following parameter (so ` |mut x, y| `
3405
3402
and ` fn f(mut x: ~int, y: ~int) ` declare one mutable variable ` x ` and
3406
3403
one immutable variable ` y ` ).
3407
3404
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
+
3408
3415
Local variables are not initialized when allocated; the entire frame worth of
3409
3416
local variables are allocated at once, on frame-entry, in an uninitialized
3410
3417
state. Subsequent statements within a function may or may not initialize the
0 commit comments