@@ -564,7 +564,7 @@ type_path_tail : '<' type_expr [ ',' type_expr ] + '>'
564
564
565
565
A _ path_ is a sequence of one or more path components _ logically_ separated by
566
566
a namespace qualifier (` :: ` ). If a path consists of only one component, it may
567
- refer to either an [ item] ( #items ) or a [ slot ] ( #memory-slots ) in a local control
567
+ refer to either an [ item] ( #items ) or a [ variable ] ( #variables ) in a local control
568
568
scope. If a path has multiple components, it refers to an item.
569
569
570
570
Every item has a _ canonical path_ within its crate, but the path naming an item
@@ -1062,9 +1062,9 @@ fn main() {}
1062
1062
A _ function item_ defines a sequence of [ statements] ( #statements ) and an
1063
1063
optional final [ expression] ( #expressions ) , along with a name and a set of
1064
1064
parameters. Functions are declared with the keyword ` fn ` . Functions declare a
1065
- set of * input* [ * slots * ] ( #memory-slots ) as parameters, through which the caller
1066
- passes arguments into the function, and an * output* [ * slot * ] ( #memory-slots )
1067
- through which the function passes results back to the caller.
1065
+ set of * input* [ * variables * ] ( #variables ) as parameters, through which the caller
1066
+ passes arguments into the function, and the * output* [ * type * ] ( #types )
1067
+ of the value the function will return to its caller on completion .
1068
1068
1069
1069
A function may also be copied into a first-class * value* , in which case the
1070
1070
value has the corresponding [ * function type* ] ( #function-types ) , and can be used
@@ -1227,7 +1227,7 @@ be undesired.
1227
1227
#### Diverging functions
1228
1228
1229
1229
A special kind of function can be declared with a ` ! ` character where the
1230
- output slot type would normally be. For example:
1230
+ output type would normally be. For example:
1231
1231
1232
1232
```
1233
1233
fn my_err(s: &str) -> ! {
@@ -2542,7 +2542,7 @@ statements](#expression-statements).
2542
2542
### Declaration statements
2543
2543
2544
2544
A _ declaration statement_ is one that introduces one or more * names* into the
2545
- enclosing statement block. The declared names may denote new slots or new
2545
+ enclosing statement block. The declared names may denote new variables or new
2546
2546
items.
2547
2547
2548
2548
#### Item declarations
@@ -2557,18 +2557,18 @@ in meaning to declaring the item outside the statement block.
2557
2557
> ** Note** : there is no implicit capture of the function's dynamic environment when
2558
2558
> declaring a function-local item.
2559
2559
2560
- #### Slot declarations
2560
+ #### Variable declarations
2561
2561
2562
2562
``` {.ebnf .gram}
2563
2563
let_decl : "let" pat [':' type ] ? [ init ] ? ';' ;
2564
2564
init : [ '=' ] expr ;
2565
2565
```
2566
2566
2567
- A _ slot declaration_ introduces a new set of slots , given by a pattern. The
2567
+ A _ variable declaration_ introduces a new set of variable , given by a pattern. The
2568
2568
pattern may be followed by a type annotation, and/or an initializer expression.
2569
2569
When no type annotation is given, the compiler will infer the type, or signal
2570
2570
an error if insufficient type information is available for definite inference.
2571
- Any slots introduced by a slot declaration are visible from the point of
2571
+ Any variables introduced by a variable declaration are visible from the point of
2572
2572
declaration until the end of the enclosing block scope.
2573
2573
2574
2574
### Expression statements
@@ -2623,7 +2623,7 @@ of any reference that points to it.
2623
2623
2624
2624
#### Moved and copied types
2625
2625
2626
- When a [ local variable] ( #memory-slots ) is used as an
2626
+ When a [ local variable] ( #variables ) is used as an
2627
2627
[ rvalue] ( #lvalues,-rvalues-and-temporaries ) the variable will either be moved
2628
2628
or copied, depending on its type. All values whose type implements ` Copy ` are
2629
2629
copied, all others are moved.
@@ -3033,10 +3033,9 @@ paren_expr_list : '(' expr_list ')' ;
3033
3033
call_expr : expr paren_expr_list ;
3034
3034
```
3035
3035
3036
- A _ call expression_ invokes a function, providing zero or more input slots and
3037
- an optional reference slot to serve as the function's output, bound to the
3038
- ` lval ` on the right hand side of the call. If the function eventually returns,
3039
- then the expression completes.
3036
+ A _ call expression_ invokes a function, providing zero or more input variables
3037
+ and an optional location to move the function's output into. If the function
3038
+ eventually returns, then the expression completes.
3040
3039
3041
3040
Some examples of call expressions:
3042
3041
@@ -3447,9 +3446,9 @@ return_expr : "return" expr ? ;
3447
3446
```
3448
3447
3449
3448
Return expressions are denoted with the keyword ` return ` . Evaluating a ` return `
3450
- expression moves its argument into the output slot of the current function,
3451
- destroys the current function activation frame, and transfers control to the
3452
- caller frame.
3449
+ expression moves its argument into the designated output location for the
3450
+ current function call, destroys the current function activation frame, and
3451
+ transfers control to the caller frame.
3453
3452
3454
3453
An example of a ` return ` expression:
3455
3454
@@ -3466,7 +3465,7 @@ fn max(a: i32, b: i32) -> i32 {
3466
3465
3467
3466
## Types
3468
3467
3469
- Every slot , item and value in a Rust program has a type. The _ type_ of a
3468
+ Every variable , item and value in a Rust program has a type. The _ type_ of a
3470
3469
* value* defines the interpretation of the memory holding it.
3471
3470
3472
3471
Built-in types and type-constructors are tightly integrated into the language,
@@ -3484,7 +3483,7 @@ The primitive types are the following:
3484
3483
* The machine-dependent integer and floating-point types.
3485
3484
3486
3485
[ ^ unittype ] : The "unit" value ` () ` is * not* a sentinel "null pointer" value for
3487
- reference slots ; the "unit" type is the implicit return type from functions
3486
+ reference variables ; the "unit" type is the implicit return type from functions
3488
3487
otherwise lacking a return type, and can be used in other contexts (such as
3489
3488
message-sending or type-parametric code) as a zero-size type.]
3490
3489
@@ -3844,7 +3843,7 @@ A Rust program's memory consists of a static set of *items* and a *heap*.
3844
3843
Immutable portions of the heap may be shared between threads, mutable portions
3845
3844
may not.
3846
3845
3847
- Allocations in the stack consist of * slots * , and allocations in the heap
3846
+ Allocations in the stack consist of * variables * , and allocations in the heap
3848
3847
consist of * boxes* .
3849
3848
3850
3849
### Memory allocation and lifetime
@@ -3863,10 +3862,11 @@ in the heap, heap allocations may outlive the frame they are allocated within.
3863
3862
When a stack frame is exited, its local allocations are all released, and its
3864
3863
references to boxes are dropped.
3865
3864
3866
- ### Memory slots
3865
+ ### Variables
3867
3866
3868
- A _ slot_ is a component of a stack frame, either a function parameter, a
3869
- [ temporary] ( #lvalues,-rvalues-and-temporaries ) , or a local variable.
3867
+ A _ variable_ is a component of a stack frame, either a named function parameter,
3868
+ an anonymous [ temporary] ( #lvalues,-rvalues-and-temporaries ) , or a named local
3869
+ variable.
3870
3870
3871
3871
A _ local variable_ (or * stack-local* allocation) holds a value directly,
3872
3872
allocated within the stack's memory. The value is a part of the stack frame.
@@ -3879,7 +3879,7 @@ Box<i32>, y: Box<i32>)` declare one mutable variable `x` and one immutable
3879
3879
variable ` y ` ).
3880
3880
3881
3881
Methods that take either ` self ` or ` Box<Self> ` can optionally place them in a
3882
- mutable slot by prefixing them with ` mut ` (similar to regular arguments):
3882
+ mutable variable by prefixing them with ` mut ` (similar to regular arguments):
3883
3883
3884
3884
```
3885
3885
trait Changer {
0 commit comments