@@ -187,19 +187,18 @@ grammar as double-quoted strings. Other tokens have exact rules given.
187
187
188
188
<p id =" keyword-table-marker " ></p >
189
189
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 |
203
202
204
203
205
204
Each of these keywords has special meaning in its grammar, and all of them are
@@ -3842,8 +3841,6 @@ x = bo(5,7);
3842
3841
``` {.ebnf .notation}
3843
3842
closure_type := [ 'unsafe' ] [ '<' lifetime-list '>' ] '|' arg-list '|'
3844
3843
[ ':' bound-list ] [ '->' type ]
3845
- procedure_type := 'proc' [ '<' lifetime-list '>' ] '(' arg-list ')'
3846
- [ ':' bound-list ] [ '->' type ]
3847
3844
lifetime-list := lifetime | lifetime ',' lifetime-list
3848
3845
arg-list := ident ':' type | ident ':' type ',' arg-list
3849
3846
bound-list := bound | bound '+' bound-list
@@ -3852,8 +3849,6 @@ bound := path | lifetime
3852
3849
3853
3850
The type of a closure mapping an input of type ` A ` to an output of type ` B ` is
3854
3851
` |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() ` .
3857
3852
3858
3853
An example of creating and calling a closure:
3859
3854
@@ -3876,30 +3871,6 @@ call_closure(closure_no_args, closure_args);
3876
3871
3877
3872
```
3878
3873
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
-
3903
3874
### Object types
3904
3875
3905
3876
Every trait item (see [ traits] ( #traits ) ) defines a type with the same name as
0 commit comments