about summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorStefan Plantikow <stefan.plantikow@googlemail.com>2011-12-02 02:15:49 +0100
committerGraydon Hoare <graydon@mozilla.com>2011-12-02 11:38:24 -0800
commit3ee2eb656e36ff9bcf5d5c13fe311e423dba9dd4 (patch)
tree0ec2024c691336b3adcb513329950e44e91a98e4 /doc
parent4ba3158e4f6f0ea1c046bcf817dcb09782c4994b (diff)
doc: added definition of trivial casts to spec
(cf @ignored Expr.Be and #1215 for intended use)
Diffstat (limited to 'doc')
-rw-r--r--doc/rust.texi11
1 files changed, 8 insertions, 3 deletions
diff --git a/doc/rust.texi b/doc/rust.texi
index 09524a8055d..540b209c074 100644
--- a/doc/rust.texi
+++ b/doc/rust.texi
@@ -2954,9 +2954,8 @@ analogous to a @code{become} expression in Newsqueak or Alef.}  destroys the
 current function activation frame and replaces it with an activation frame for
 the called function. In other words, @code{be} executes a tail-call. The
 syntactic form of a @code{be} expression is therefore limited to @emph{tail
-position}: its argument must be a @emph{call expression}, and it must be the
-last expression in a block.
-
+position}: its argument must be a @emph{call expression} or a @{trivial cast}
+of a @emph{call expression}, and it must be the last expression in a block.
 An example of a @code{be} expression:
 @example
 fn print_loop(n: int) @{
@@ -2971,6 +2970,7 @@ fn print_loop(n: int) @{
 
 The above example executes in constant space, replacing each frame with a new
 copy of itself.
+
 @end ignore
 
 
@@ -3001,6 +3001,7 @@ execution and destroying the iterator frame.
 @cindex As expression
 @cindex Cast
 @cindex Typecast
+@cindex Trivial cast
 
 Executing an @code{as} expression casts the value on the left-hand side to the
 type on the right-hand side.
@@ -3018,6 +3019,10 @@ fn avg(v: [float]) -> float @{
 @}
 @end example
 
+A cast is a @emph{trivial cast} iff the type of the casted expression and the
+target type are identical after replacing all occurences of @code{int},
+@code{uint}, @code{float} with their machine type equivalents of the
+target architecture in both types.
 
 @node       Ref.Expr.Fail
 @subsection Ref.Expr.Fail