From e257f390e12f3eb414152a474259ccd8641627aa Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Thu, 11 Oct 2012 13:10:43 -0700 Subject: [PATCH] manual: add section for unary move expressions. --- doc/rust.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/rust.md b/doc/rust.md index f7a70e9fd04..feed0a81778 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -1919,6 +1919,20 @@ mutate(copy v); // Pass a copy assert v[0] == 1; // Original was not modified ~~~~ +### Unary move expressions + +~~~~~~~~{.ebnf .gram} +move_expr : "move" expr ; +~~~~~~~~ + +A _unary move expression_ is similar to a [unary copy](#unary-copy-expressions) expression, +except that it can only be applied to an [lvalue](#lvalues-rvalues-and-temporaries), +and it performs a _move_ on its operand, rather than a copy. +That is, the memory location denoted by its operand is de-initialized after evaluation, +and the resulting value is a shallow copy of the operand, +even if the operand is an [owning type](#type-kinds). + + ### Call expressions ~~~~~~~~ {.abnf .gram}