about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMasaki Hara <ackie.h.gmai@gmail.com>2018-07-12 20:26:13 +0900
committerMasaki Hara <ackie.h.gmai@gmail.com>2018-08-19 08:07:33 +0900
commit438edc3d5e60f82f22db07b6e8562fc8836a4cbe (patch)
tree2dfab03257c7e44d45363dfef782d7e0053c0f7c /src
parentc72e87e30a46a1d0a97954d5fed965c88a0b7ce2 (diff)
downloadrust-438edc3d5e60f82f22db07b6e8562fc8836a4cbe.tar.gz
rust-438edc3d5e60f82f22db07b6e8562fc8836a4cbe.zip
Update the unstable book regarding [e; dyn n].
Diffstat (limited to 'src')
-rw-r--r--src/doc/unstable-book/src/language-features/unsized-locals.md6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/doc/unstable-book/src/language-features/unsized-locals.md b/src/doc/unstable-book/src/language-features/unsized-locals.md
index ff5a6bcfbf7..f779edc89e7 100644
--- a/src/doc/unstable-book/src/language-features/unsized-locals.md
+++ b/src/doc/unstable-book/src/language-features/unsized-locals.md
@@ -127,13 +127,13 @@ One of the objectives of this feature is to allow `Box<dyn FnOnce>`, instead of
 
 ## Variable length arrays
 
-The RFC also describes an extension to the array literal syntax `[e; n]`: you'll be able to specify non-const `n` to allocate variable length arrays on the stack.
+The RFC also describes an extension to the array literal syntax: `[e; dyn n]`. In the syntax, `n` isn't necessarily a constant expression. The array is dynamically allocated on the stack and has the type of `[T]`, instead of `[T; n]`.
 
 ```rust,ignore
 #![feature(unsized_locals)]
 
 fn mergesort<T: Ord>(a: &mut [T]) {
-    let mut tmp = [T; a.len()];
+    let mut tmp = [T; dyn a.len()];
     // ...
 }
 
@@ -144,7 +144,7 @@ fn main() {
 }
 ```
 
-VLAs are not implemented yet.
+VLAs are not implemented yet. The syntax isn't final, either. We may need an alternative syntax for Rust 2015 because, in Rust 2015, expressions like `[e; dyn(1)]` would be ambiguous. One possible alternative proposed in the RFC is `[e; n]`: if `n` captures one or more local variables, then it is considered as `[e; dyn n]`.
 
 ## Advisory on stack usage