mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Inherited mutabilty clarification
Also no longer reference mutable fields
This commit is contained in:
parent
381c08bf69
commit
2750adb5d8
@ -590,9 +590,8 @@ struct Point {
|
||||
}
|
||||
~~~~
|
||||
|
||||
Inherited mutability means that any field of a struct may be mutable, if the
|
||||
struct is in a mutable slot (or a field of a struct in a mutable slot, and
|
||||
so forth).
|
||||
Structs have "inherited mutability", which means that any field of a struct
|
||||
may be mutable, if the struct is in a mutable slot.
|
||||
|
||||
With a value (say, `mypoint`) of such a type in a mutable location, you can do
|
||||
`mypoint.y += 1.0`. But in an immutable location, such an assignment to a
|
||||
|
Loading…
Reference in New Issue
Block a user