diff --git a/doc/rust.md b/doc/rust.md index dddd372dcc8..5936f6b2848 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -2206,7 +2206,12 @@ fn main() { } ~~~~ -A pattern that's just a variable binding, +Patterns that bind variables default to binding to a copy of the matched value. This can be made +explicit using the ```copy``` keyword, changed to bind to a borrowed pointer by using the ```ref``` +keyword, or to a mutable borrowed pointer using ```ref mut```, or the value can be moved into +the new binding using ```move```. + +A pattern that's just an identifier, like `Nil` in the previous answer, could either refer to an enum variant that's in scope, or bind a new variable.