Skip to content

Commit 7f2f09f

Browse files
committed
Eliminate the obsolete term 'slot'.
1 parent 21e2e6e commit 7f2f09f

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

src/doc/complement-lang-faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Yes. Calling C code from Rust is simple and exactly as efficient as calling C co
124124

125125
Yes. The Rust code has to be exposed via an `extern` declaration, which makes it C-ABI compatible. Such a function can be passed to C code as a function pointer or, if given the `#[no_mangle]` attribute to disable symbol mangling, can be called directly from C code.
126126

127-
## Why aren't function signatures inferred? Why only local slots?
127+
## Why aren't function signatures inferred? Why only local variables?
128128

129129
* Mechanically, it simplifies the inference algorithm; inference only requires looking at one function at a time.
130130
* The same simplification goes double for human readers. A reader does not need an IDE running an inference algorithm across an entire crate to be able to guess at a function's argument types; it's always explicit and nearby.

src/doc/grammar.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ meta_seq : meta_item [ ',' meta_seq ] ? ;
426426
**FIXME:** grammar?
427427

428428
A _declaration statement_ is one that introduces one or more *names* into the
429-
enclosing statement block. The declared names may denote new slots or new
429+
enclosing statement block. The declared names may denote new variables or new
430430
items.
431431

432432
#### Item declarations
@@ -440,7 +440,7 @@ function, enumeration, structure, type, static, trait, implementation or module
440440
scope to a narrow region containing all of its uses; it is otherwise identical
441441
in meaning to declaring the item outside the statement block.
442442

443-
#### Slot declarations
443+
#### Variable declarations
444444

445445
```antlr
446446
let_decl : "let" pat [':' type ] ? [ init ] ? ';' ;
@@ -762,7 +762,7 @@ bound := path | lifetime
762762

763763
### Memory ownership
764764

765-
### Memory slots
765+
### Variables
766766

767767
### Boxes
768768

src/doc/reference.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ type_path_tail : '<' type_expr [ ',' type_expr ] + '>'
564564

565565
A _path_ is a sequence of one or more path components _logically_ separated by
566566
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
568568
scope. If a path has multiple components, it refers to an item.
569569

570570
Every item has a _canonical path_ within its crate, but the path naming an item
@@ -1062,9 +1062,9 @@ fn main() {}
10621062
A _function item_ defines a sequence of [statements](#statements) and an
10631063
optional final [expression](#expressions), along with a name and a set of
10641064
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.
10681068

10691069
A function may also be copied into a first-class *value*, in which case the
10701070
value has the corresponding [*function type*](#function-types), and can be used
@@ -1227,7 +1227,7 @@ be undesired.
12271227
#### Diverging functions
12281228

12291229
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:
12311231

12321232
```
12331233
fn my_err(s: &str) -> ! {
@@ -2542,7 +2542,7 @@ statements](#expression-statements).
25422542
### Declaration statements
25432543

25442544
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
25462546
items.
25472547

25482548
#### Item declarations
@@ -2557,18 +2557,18 @@ in meaning to declaring the item outside the statement block.
25572557
> **Note**: there is no implicit capture of the function's dynamic environment when
25582558
> declaring a function-local item.
25592559
2560-
#### Slot declarations
2560+
#### Variable declarations
25612561

25622562
```{.ebnf .gram}
25632563
let_decl : "let" pat [':' type ] ? [ init ] ? ';' ;
25642564
init : [ '=' ] expr ;
25652565
```
25662566

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
25682568
pattern may be followed by a type annotation, and/or an initializer expression.
25692569
When no type annotation is given, the compiler will infer the type, or signal
25702570
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
25722572
declaration until the end of the enclosing block scope.
25732573

25742574
### Expression statements
@@ -2623,7 +2623,7 @@ of any reference that points to it.
26232623

26242624
#### Moved and copied types
26252625

2626-
When a [local variable](#memory-slots) is used as an
2626+
When a [local variable](#variables) is used as an
26272627
[rvalue](#lvalues,-rvalues-and-temporaries) the variable will either be moved
26282628
or copied, depending on its type. All values whose type implements `Copy` are
26292629
copied, all others are moved.
@@ -3033,10 +3033,9 @@ paren_expr_list : '(' expr_list ')' ;
30333033
call_expr : expr paren_expr_list ;
30343034
```
30353035

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.
30403039

30413040
Some examples of call expressions:
30423041

@@ -3447,9 +3446,9 @@ return_expr : "return" expr ? ;
34473446
```
34483447

34493448
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.
34533452

34543453
An example of a `return` expression:
34553454

@@ -3466,7 +3465,7 @@ fn max(a: i32, b: i32) -> i32 {
34663465

34673466
## Types
34683467

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
34703469
*value* defines the interpretation of the memory holding it.
34713470

34723471
Built-in types and type-constructors are tightly integrated into the language,
@@ -3484,7 +3483,7 @@ The primitive types are the following:
34843483
* The machine-dependent integer and floating-point types.
34853484

34863485
[^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
34883487
otherwise lacking a return type, and can be used in other contexts (such as
34893488
message-sending or type-parametric code) as a zero-size type.]
34903489

@@ -3844,7 +3843,7 @@ A Rust program's memory consists of a static set of *items* and a *heap*.
38443843
Immutable portions of the heap may be shared between threads, mutable portions
38453844
may not.
38463845

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
38483847
consist of *boxes*.
38493848

38503849
### Memory allocation and lifetime
@@ -3863,10 +3862,11 @@ in the heap, heap allocations may outlive the frame they are allocated within.
38633862
When a stack frame is exited, its local allocations are all released, and its
38643863
references to boxes are dropped.
38653864

3866-
### Memory slots
3865+
### Variables
38673866

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.
38703870

38713871
A _local variable_ (or *stack-local* allocation) holds a value directly,
38723872
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
38793879
variable `y`).
38803880

38813881
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):
38833883

38843884
```
38853885
trait Changer {

0 commit comments

Comments
 (0)