Skip to content

Commit 3b7be07

Browse files
authored
Merge pull request #1037 from kklibo/fix_typos
Fix typos + grammar
2 parents 0fe357f + 314567f commit 3b7be07

15 files changed

+25
-25
lines changed

src/destructors.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Destructors
22

33
When an [initialized] [variable] or [temporary] goes out of
4-
[scope](#drop-scopes) its *destructor* is run, or it is *dropped*. [Assignment]
4+
[scope](#drop-scopes), its *destructor* is run, or it is *dropped*. [Assignment]
55
also runs the destructor of its left-hand operand, if it's initialized. If a
66
variable has been partially initialized, only its initialized fields are
77
dropped.
@@ -154,7 +154,7 @@ temporary variable that holds the result of that expression when used in a
154154
[place context], unless it is [promoted].
155155

156156
Apart from lifetime extension, the temporary scope of an expression is the
157-
smallest scope that contains the expression and is for one of the following:
157+
smallest scope that contains the expression and is one of the following:
158158

159159
* The entire function body.
160160
* A statement.
@@ -246,7 +246,8 @@ loop {
246246
### Constant promotion
247247

248248
Promotion of a value expression to a `'static` slot occurs when the expression
249-
could be written in a constant, borrowed, and dereferencing that borrow where
249+
could be written in a constant and borrowed, and that borrow could be dereferenced
250+
where
250251
the expression was originally written, without changing the runtime behavior.
251252
That is, the promoted expression can be evaluated at compile-time and the
252253
resulting value does not contain [interior mutability] or [destructors] (these

src/dynamically-sized-types.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ types">DSTs</abbr>. Such types can only be used in certain cases:
1818
types">DSTs</abbr>.
1919
Unlike with generic type parameters, `Self: ?Sized` is the default in trait definitions.
2020
* Structs may contain a <abbr title="dynamically sized type">DST</abbr> as the
21-
last field, this makes the struct itself a
21+
last field; this makes the struct itself a
2222
<abbr title="dynamically sized type">DST</abbr>.
2323

2424
> **Note**: [variables], function parameters, [const] items, and [static] items must be

src/expressions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ move the value. Only the following place expressions may be moved out of:
179179
* [Variables] which are not currently borrowed.
180180
* [Temporary values](#temporaries).
181181
* [Fields][field] of a place expression which can be moved out of and
182-
doesn't implement [`Drop`].
182+
don't implement [`Drop`].
183183
* The result of [dereferencing][deref] an expression with type [`Box<T>`] and
184184
that can also be moved out of.
185185

186-
When moving out of a place expression that evaluates to a local variable, the
186+
After moving out of a place expression that evaluates to a local variable, the
187187
location is deinitialized and cannot be read from again until it is
188188
reinitialized. In all other cases, trying to use a place expression in a value
189189
expression context is an error.

src/expressions/loop-expr.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ for n in 1..11 {
148148
assert_eq!(sum, 55);
149149
```
150150

151-
A for loop is equivalent to the following block expression.
151+
A `for` loop is equivalent to a `loop` expression containing a [`match` expression] as follows:
152152

153153
<!-- ignore: expansion example -->
154154
```rust,ignore

src/expressions/method-call-expr.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ These cases require a [disambiguating function call syntax] for method and funct
7171
***Warning:*** For [trait objects], if there is an inherent method of the same name as a trait method, it will give a compiler error when trying to call the method in a method call expression.
7272
Instead, you can call the method using [disambiguating function call syntax], in which case it calls the trait method, not the inherent method.
7373
There is no way to call the inherent method.
74-
Just don't define inherent methods on trait objects with the same name a trait method and you'll be fine.
74+
Just don't define inherent methods on trait objects with the same name as a trait method and you'll be fine.
7575
7676
</div>
7777

src/glossary.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ implementation.
125125

126126
A variable is initialized if it has been assigned a value and hasn't since been
127127
moved from. All other memory locations are assumed to be uninitialized. Only
128-
unsafe Rust can create such a memory without initializing it.
128+
unsafe Rust can create a memory location without initializing it.
129129

130130
### Local trait
131131

src/items/extern-crates.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ by using an underscore with the form `extern crate foo as _`. This may be
6464
useful for crates that only need to be linked, but are never referenced, and
6565
will avoid being reported as unused.
6666

67-
The [`macro_use` attribute] works as usual and import the macro names
67+
The [`macro_use` attribute] works as usual and imports the macro names
6868
into the [`macro_use` prelude].
6969

7070
## The `no_link` attribute

src/items/external-blocks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ External blocks provide _declarations_ of items that are not _defined_ in the
1717
current crate and are the basis of Rust's foreign function interface. These are
1818
akin to unchecked imports.
1919

20-
Two kind of item _declarations_ are allowed in external blocks: [functions] and
20+
Two kinds of item _declarations_ are allowed in external blocks: [functions] and
2121
[statics]. Calling functions or accessing statics that are declared in external
2222
blocks is only allowed in an `unsafe` context.
2323

src/items/functions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ If the first parameter is a _SelfParam_, this indicates that the function is a
7474
function] in a [trait] or [implementation].
7575

7676
A parameter with the `...` token indicates a [variadic function], and may only
77-
be used as the last parameter of a [external block] function. The variadic
77+
be used as the last parameter of an [external block] function. The variadic
7878
parameter may have an optional identifier, such as `args: ...`.
7979

8080
## Function body

src/items/implementations.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ fn main() {
8787
## Trait Implementations
8888

8989
A _trait implementation_ is defined like an inherent implementation except that
90-
the optional generic type declarations is followed by a [trait] followed
91-
by the keyword `for`. Followed by a path to a nominal type.
90+
the optional generic type declarations are followed by a [trait], followed
91+
by the keyword `for`, followed by a path to a nominal type.
9292

9393
<!-- To understand this, you have to back-reference to the previous section. :( -->
9494

@@ -265,7 +265,7 @@ impl<'a> HasAssocType for Struct {
265265

266266
Implementations may contain outer [attributes] before the `impl` keyword and
267267
inner [attributes] inside the brackets that contain the associated items. Inner
268-
attributes must come before any associated items. That attributes that have
268+
attributes must come before any associated items. The attributes that have
269269
meaning here are [`cfg`], [`deprecated`], [`doc`], and [the lint check
270270
attributes].
271271

src/items/modules.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ contents in a file named `mod.rs` within that directory. The above example can
6565
alternately be expressed with `crate::util`'s contents in a file named
6666
`util/mod.rs`. It is not allowed to have both `util.rs` and `util/mod.rs`.
6767

68-
> **Note**: Previous to `rustc` 1.30, using `mod.rs` files was the way to load
68+
> **Note**: Prior to `rustc` 1.30, using `mod.rs` files was the way to load
6969
> a module with nested children. It is encouraged to use the new naming
7070
> convention as it is more consistent, and avoids having many files named
7171
> `mod.rs` within a project.

src/lifetime-elision.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ If neither of those rules apply, then the bounds on the trait are used:
103103
// For the following trait...
104104
trait Foo { }
105105

106-
// These two are the same as Box<T> has no lifetime bound on T
106+
// These two are the same because Box<T> has no lifetime bound on T
107107
type T1 = Box<dyn Foo>;
108108
type T2 = Box<dyn Foo + 'static>;
109109

src/names/preludes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
A *prelude* is a collection of names that are automatically brought into scope
44
of every module in a crate.
55

6-
These prelude names are not part of the module itself, they are implicitly
6+
These prelude names are not part of the module itself: they are implicitly
77
queried during [name resolution]. For example, even though something like
88
[`Box`] is in scope in every module, you cannot refer to it as `self::Box`
99
because it is not a member of the current module.

src/types/closure.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ let z = &x;
106106

107107
In this case, borrowing `x` mutably is not possible, because `x` is not `mut`.
108108
But at the same time, borrowing `x` immutably would make the assignment illegal,
109-
because a `& &mut` reference may not be unique, so it cannot safely be used to
109+
because a `& &mut` reference might not be unique, so it cannot safely be used to
110110
modify a value. So a unique immutable borrow is used: it borrows `x` immutably,
111111
but like a mutable borrow, it must be unique. In the above example, uncommenting
112112
the declaration of `y` will produce an error because it would violate the

src/types/slice.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
A slice is a [dynamically sized type] representing a 'view' into a sequence of
88
elements of type `T`. The slice type is written as `[T]`.
99

10-
To use a slice type it generally has to be used behind a pointer for example
11-
as:
10+
Slice types are generally used through pointer types. For example:
1211

13-
* `&[T]`, a 'shared slice', often just called a 'slice', it doesn't own the
14-
data it points to, it borrows it.
15-
* `&mut [T]`, a 'mutable slice', mutably borrows the data it points to.
16-
* `Box<[T]>`, a 'boxed slice'
12+
* `&[T]`: a 'shared slice', often just called a 'slice'. It doesn't own the
13+
data it points to; it borrows it.
14+
* `&mut [T]`: a 'mutable slice'. It mutably borrows the data it points to.
15+
* `Box<[T]>`: a 'boxed slice'
1716

1817
Examples:
1918

0 commit comments

Comments
 (0)