about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorclubby789 <jamie@hill-daniel.co.uk>2023-02-27 13:07:44 +0000
committerclubby789 <jamie@hill-daniel.co.uk>2023-03-12 13:19:46 +0000
commitdd7df04e168324fc002ab4985b6c7513f08ccf49 (patch)
treed20567e06dfccad24f16dabddb42852a498a8c1a /src/doc
parent24c0b81c1fd5de8e00276524896d3352ed91a8cb (diff)
downloadrust-dd7df04e168324fc002ab4985b6c7513f08ccf49.tar.gz
rust-dd7df04e168324fc002ab4985b6c7513f08ccf49.zip
Remove uses of `box_syntax` in rustc and tools
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/unstable-book/src/the-unstable-book.md23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/doc/unstable-book/src/the-unstable-book.md b/src/doc/unstable-book/src/the-unstable-book.md
index 554c52c3c9c..9090b134dc6 100644
--- a/src/doc/unstable-book/src/the-unstable-book.md
+++ b/src/doc/unstable-book/src/the-unstable-book.md
@@ -5,16 +5,31 @@ each one organized by a "feature flag." That is, when using an unstable
 feature of Rust, you must use a flag, like this:
 
 ```rust
-#![feature(box_syntax)]
+#![feature(generators, generator_trait)]
+
+use std::ops::{Generator, GeneratorState};
+use std::pin::Pin;
 
 fn main() {
-    let five = box 5;
+    let mut generator = || {
+        yield 1;
+        return "foo"
+    };
+
+    match Pin::new(&mut generator).resume(()) {
+        GeneratorState::Yielded(1) => {}
+        _ => panic!("unexpected value from resume"),
+    }
+    match Pin::new(&mut generator).resume(()) {
+        GeneratorState::Complete("foo") => {}
+        _ => panic!("unexpected value from resume"),
+    }
 }
 ```
 
-The `box_syntax` feature [has a chapter][box] describing how to use it.
+The `generators` feature [has a chapter][generators] describing how to use it.
 
-[box]: language-features/box-syntax.md
+[generators]: language-features/generators.md
 
 Because this documentation relates to unstable features, we make no guarantees
 that what is contained here is accurate or up to date. It's developed on a