Skip to content

Commit 7c26317

Browse files
nikomatsakisManishearth
authored andcommitted
Update guide/intro to take into account the removal of proc.
cc @steveklabnick
1 parent 48d5014 commit 7c26317

File tree

1 file changed

+12
-41
lines changed

1 file changed

+12
-41
lines changed

reference.md

Lines changed: 12 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -187,19 +187,18 @@ grammar as double-quoted strings. Other tokens have exact rules given.
187187

188188
<p id="keyword-table-marker"></p>
189189

190-
| | | | | |
191-
|----------|----------|----------|----------|--------|
192-
| abstract | alignof | as | be | box |
193-
| break | const | continue | crate | do |
194-
| else | enum | extern | false | final |
195-
| fn | for | if | impl | in |
196-
| let | loop | match | mod | move |
197-
| mut | offsetof | once | override | priv |
198-
| proc | pub | pure | ref | return |
199-
| sizeof | static | self | struct | super |
200-
| true | trait | type | typeof | unsafe |
201-
| unsized | use | virtual | where | while |
202-
| yield | | | | |
190+
| | | | | |
191+
|----------|----------|----------|----------|---------|
192+
| abstract | alignof | as | be | box |
193+
| break | const | continue | crate | do |
194+
| else | enum | extern | false | final |
195+
| fn | for | if | impl | in |
196+
| let | loop | match | mod | move |
197+
| mut | offsetof | once | override | priv |
198+
| pub | pure | ref | return | sizeof |
199+
| static | self | struct | super | true |
200+
| trait | type | typeof | unsafe | unsized |
201+
| use | virtual | where | while | yield |
203202

204203

205204
Each of these keywords has special meaning in its grammar, and all of them are
@@ -3842,8 +3841,6 @@ x = bo(5,7);
38423841
```{.ebnf .notation}
38433842
closure_type := [ 'unsafe' ] [ '<' lifetime-list '>' ] '|' arg-list '|'
38443843
[ ':' bound-list ] [ '->' type ]
3845-
procedure_type := 'proc' [ '<' lifetime-list '>' ] '(' arg-list ')'
3846-
[ ':' bound-list ] [ '->' type ]
38473844
lifetime-list := lifetime | lifetime ',' lifetime-list
38483845
arg-list := ident ':' type | ident ':' type ',' arg-list
38493846
bound-list := bound | bound '+' bound-list
@@ -3852,8 +3849,6 @@ bound := path | lifetime
38523849

38533850
The type of a closure mapping an input of type `A` to an output of type `B` is
38543851
`|A| -> B`. A closure with no arguments or return values has type `||`.
3855-
Similarly, a procedure mapping `A` to `B` is `proc(A) -> B` and a no-argument
3856-
and no-return value closure has type `proc()`.
38573852

38583853
An example of creating and calling a closure:
38593854

@@ -3876,30 +3871,6 @@ call_closure(closure_no_args, closure_args);
38763871

38773872
```
38783873

3879-
Unlike closures, procedures may only be invoked once, but own their
3880-
environment, and are allowed to move out of their environment. Procedures are
3881-
allocated on the heap (unlike closures). An example of creating and calling a
3882-
procedure:
3883-
3884-
```rust
3885-
let string = "Hello".to_string();
3886-
3887-
// Creates a new procedure, passing it to the `spawn` function.
3888-
spawn(proc() {
3889-
println!("{} world!", string);
3890-
});
3891-
3892-
// the variable `string` has been moved into the previous procedure, so it is
3893-
// no longer usable.
3894-
3895-
3896-
// Create an invoke a procedure. Note that the procedure is *moved* when
3897-
// invoked, so it cannot be invoked again.
3898-
let f = proc(n: int) { n + 22 };
3899-
println!("answer: {}", f(20));
3900-
3901-
```
3902-
39033874
### Object types
39043875

39053876
Every trait item (see [traits](#traits)) defines a type with the same name as

0 commit comments

Comments
 (0)