Skip to content

Commit d3fdf75

Browse files
committed
Whitespace cleanup and some punctuation
1 parent 058e955 commit d3fdf75

12 files changed

+45
-47
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ but we leave these instructions for when we do it again in the future.
100100

101101
7. Click on the log and Ctrl-f to get a search box in the log
102102

103-
8. Search for rustc-dev-guide. This gets you to the place where the links are checked. It is usually ~11K lines into the log
103+
8. Search for rustc-dev-guide. This gets you to the place where the links are checked. It is usually ~11K lines into the log.
104104

105105
9. Look at the links in the log near that point in the log
106106

src/about-this-guide.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ a correction!
4747
If you do contribute to the guide, please see the corresponding
4848
[subsection on writing documentation in this guide].
4949

50-
[subsection on writing documentation in this guide]: contributing.md#contributing-to-rustc-dev-guide.
50+
[subsection on writing documentation in this guide]: contributing.md#contributing-to-rustc-dev-guide
5151

5252
> “‘All conditioned things are impermanent’ — when one sees this with wisdom, one turns away from
5353
> suffering.” _The Dhammapada, verse 277_

src/backend/implicit-caller-location.md

+22-22
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<!-- toc -->
44

55
Approved in [RFC 2091], this feature enables the accurate reporting of caller location during panics
6-
initiated from functions like `Option::unwrap`, `Result::expect`, and `Index::index`. This feature
7-
adds the [`#[track_caller]`][attr-reference] attribute for functions, the
8-
[`caller_location`][intrinsic] intrinsic, and the stabilization-friendly
6+
initiated from functions like `Option::unwrap`, `Result::expect`, and `Index::index`. This feature
7+
adds the [`#[track_caller]`][attr-reference] attribute for functions, the
8+
[`caller_location`][intrinsic] intrinsic, and the stabilization-friendly
99
[`core::panic::Location::caller`][wrapper] wrapper.
1010

1111
## Motivating Example
@@ -30,25 +30,25 @@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
3030
As of 1.42, we get a much more helpful message:
3131

3232
```
33-
$ rustc +1.42.0 example.rs; example.exe
33+
$ rustc +1.42.0 example.rs; example.exe
3434
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', example.rs:3:5
3535
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
3636
```
3737

3838
These error messages are achieved through a combination of changes to `panic!` internals to make use
39-
of `core::panic::Location::caller` and a number of `#[track_caller]` annotations in the standard
39+
of `core::panic::Location::caller` and a number of `#[track_caller]` annotations in the standard
4040
library which propagate caller information.
4141

4242
## Reading Caller Location
4343

4444
Previously, `panic!` made use of the `file!()`, `line!()`, and `column!()` macros to construct a
4545
[`Location`] pointing to where the panic occurred. These macros couldn't be given an overridden
46-
location, so functions which intentionally invoked `panic!` couldn't provide their own location,
46+
location, so functions which intentionally invoked `panic!` couldn't provide their own location,
4747
hiding the actual source of error.
4848

49-
Internally, `panic!()` now calls [`core::panic::Location::caller()`][wrapper] to find out where it
50-
was expanded. This function is itself annotated with `#[track_caller]` and wraps the
51-
[`caller_location`][intrinsic] compiler intrinsic implemented by rustc. This intrinsic is easiest
49+
Internally, `panic!()` now calls [`core::panic::Location::caller()`][wrapper] to find out where it
50+
was expanded. This function is itself annotated with `#[track_caller]` and wraps the
51+
[`caller_location`][intrinsic] compiler intrinsic implemented by rustc. This intrinsic is easiest
5252
explained in terms of how it works in a `const` context.
5353

5454
## Caller Location in `const`
@@ -58,20 +58,20 @@ to find the right location and allocating a const value to return.
5858

5959
### Finding the right `Location`
6060

61-
In a const context we "walk up the stack" from where the intrinsic is invoked, stopping when we
61+
In a const context we "walk up the stack" from where the intrinsic is invoked, stopping when we
6262
reach the first function call in the stack which does *not* have the attribute. This walk is in
6363
[`InterpCx::find_closest_untracked_caller_location()`][const-find-closest].
6464

65-
Starting at the bottom, we iterate up over stack [`Frame`][const-frame]s in the
65+
Starting at the bottom, we iterate up over stack [`Frame`][const-frame]s in the
6666
[`InterpCx::stack`][const-stack], calling
67-
[`InstanceDef::requires_caller_location`][requires-location] on the
67+
[`InstanceDef::requires_caller_location`][requires-location] on the
6868
[`Instance`s from each `Frame`][frame-instance]. We stop once we find one that returns `false` and
6969
return the span of the *previous* frame which was the "topmost" tracked function.
7070

7171
### Allocating a static `Location`
7272

73-
Once we have a `Span`, we need to allocate static memory for the `Location`, which is performed by
74-
the [`TyCtxt::const_caller_location()`][const-location-query] query. Internally this calls
73+
Once we have a `Span`, we need to allocate static memory for the `Location`, which is performed by
74+
the [`TyCtxt::const_caller_location()`][const-location-query] query. Internally this calls
7575
[`InterpCx::alloc_caller_location()`][alloc-location] and results in a unique
7676
[memory kind][location-memory-kind] (`MemoryKind::CallerLocation`). The SSA codegen backend is able
7777
to emit code for these same values, and we use this code there as well.
@@ -80,14 +80,14 @@ Once our `Location` has been allocated in static memory, our intrinsic returns a
8080

8181
## Generating code for `#[track_caller]` callees
8282

83-
To generate efficient code for a tracked function and its callers, we need to provide the same
83+
To generate efficient code for a tracked function and its callers, we need to provide the same
8484
behavior from the intrinsic's point of view without having a stack to walk up at runtime. We invert
8585
the approach: as we grow the stack down we pass an additional argument to calls of tracked functions
8686
rather than walking up the stack when the intrinsic is called. That additional argument can be
8787
returned wherever the caller location is queried.
8888

8989
The argument we append is of type `&'static core::panic::Location<'static>`. A reference was chosen
90-
to avoid unnecessary copying because a pointer is a third the size of
90+
to avoid unnecessary copying because a pointer is a third the size of
9191
`std::mem::size_of::<core::panic::Location>() == 24` at time of writing.
9292

9393
When generating a call to a function which is tracked, we pass the location argument the value of
@@ -153,12 +153,12 @@ probably the best we can do without modifying fully-stabilized type signatures.
153153

154154
> *Note:* We always emit a [`ReifyShim`] when taking a pointer to a tracked function. While the
155155
> constraint here is imposed by codegen contexts, we don't know during MIR construction of the shim
156-
> whether we'll be called in a const context (safe to ignore shim) or in a codegen context (unsafe
156+
> whether we'll be called in a const context (safe to ignore shim) or in a codegen context (unsafe
157157
> to ignore shim). Even if we did know, the results from const and codegen contexts must agree.
158158
159159
## The Attribute
160160

161-
The `#[track_caller]` attribute is checked alongside other codegen attributes to ensure the
161+
The `#[track_caller]` attribute is checked alongside other codegen attributes to ensure the
162162
function:
163163

164164
* has the `"Rust"` ABI (as opposed to e.g., `"C"`)
@@ -173,7 +173,7 @@ used in both const and codegen contexts to ensure correct propagation.
173173

174174
When applied to trait method implementations, the attribute works as it does for regular functions.
175175

176-
When applied to a trait method prototype, the attribute applies to all implementations of the
176+
When applied to a trait method prototype, the attribute applies to all implementations of the
177177
method. When applied to a default trait method implementation, the attribute takes effect on
178178
that implementation *and* any overrides.
179179

@@ -205,14 +205,14 @@ trait TrackedFourWays {
205205
assert_tracked!();
206206
}
207207

208-
/// Overrides of this implementation are tracked (it is too).
208+
/// Overrides of this implementation are tracked (it is too).
209209
#[track_caller]
210210
fn default_tracked_to_override() {
211211
assert_tracked!();
212212
}
213213
}
214214

215-
/// This impl uses the default impl for `default_tracked` and provides its own for
215+
/// This impl uses the default impl for `default_tracked` and provides its own for
216216
/// `default_tracked_to_override`.
217217
impl TrackedFourWays for () {
218218
fn blanket_tracked() {
@@ -255,7 +255,7 @@ up on the tracking issue. During the course of implementing that, it was also di
255255
implementation was possible without modifying the number of arguments in a function's MIR, which
256256
would simplify later stages and unlock use in traits.
257257

258-
Because the RFC's implementation strategy could not readily support traits, the semantics were not
258+
Because the RFC's implementation strategy could not readily support traits, the semantics were not
259259
originally specified. They have since been implemented following the path which seemed most correct
260260
to the author and reviewers.
261261

src/backend/monomorph.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ units](../appendix/glossary.md#codegen-unit).
5959

6060
## Codegen Unit (CGU) partitioning
6161

62-
For better incremental build times, the CGU partitioner creates two CGU for each source level
63-
modules. One is for "stable" i.e. non-generic code and the other is more volatile code i.e.
62+
For better incremental build times, the CGU partitioner creates two CGU for each source level
63+
modules. One is for "stable" i.e. non-generic code and the other is more volatile code i.e.
6464
monoporphized/specialized instances.
6565

6666
For depenencies, consider Crate A and Crate B, such that Crate B depends on Crate A.
67-
The following table lists different scenarios for a function in Crate A that might be used by one
67+
The following table lists different scenarios for a function in Crate A that might be used by one
6868
or more modules in Crate B.
6969

7070
| Crate A function | Behavior |

src/borrow_check/moves_and_initialization/move_paths.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ at the field granularity:
99
```rust,ignore
1010
fn foo() {
1111
let a: (Vec<u32>, Vec<u32>) = (vec![22], vec![44]);
12-
12+
1313
// a.0 and a.1 are both initialized
14-
14+
1515
let b = a.0; // moves a.0
16-
16+
1717
// a.0 is not initialized, but a.1 still is
1818
1919
let c = a.0; // ERROR
@@ -75,7 +75,7 @@ there is no need for a [`MovePathIndex`]. Some examples:
7575
there would be no move-path for `foo[1]`.
7676
- You cannot move from inside of a borrowed reference, so if we have e.g. `foo: &String`,
7777
there would be no move-path for `*foo`.
78-
78+
7979
These rules are enforced by the [`move_path_for`] function, which
8080
converts a [`Place`] into a [`MovePathIndex`] -- in error cases like
8181
those just discussed, the function returns an `Err`. This in turn
@@ -104,7 +104,7 @@ of [`MoveData`]. There are two different methods:
104104
[`LookupResult`] indicating the closest path it was able to find
105105
that exists (e.g., for `foo[1]`, it might return just the path for
106106
`foo`).
107-
107+
108108
[`find`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/dataflow/move_paths/struct.MovePathLookup.html#method.find
109109
[`find_local`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/dataflow/move_paths/struct.MovePathLookup.html#method.find_local
110110
[`mir::Local`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.Local.html
@@ -122,7 +122,7 @@ just over the paths that are **actually referenced** in the source,
122122
not all **possible** paths that could have been referenced). These
123123
references are used for example in the
124124
[`find_in_move_path_or_its_descendants`] function, which determines
125-
whether a move-path (e.g., `a.b`) or any child of that move-path
125+
whether a move-path (e.g., `a.b`) or any child of that move-path
126126
(e.g.,`a.b.c`) matches a given predicate.
127127

128128
[`Place`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.Place.html

src/compiler-debugging.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ chapter](./backend/debugging.md)).
1111

1212
## Configuring the compiler
1313

14-
By default, rustc is built without most debug information. To enable debug info,
15-
set `debug = true` in your config.toml.
14+
By default, rustc is built without most debug information. To enable debug info,
15+
set `debug = true` in your config.toml.
1616

17-
Setting `debug = true` turns on many different debug options (e.g., `debug-assertions`,
18-
`debug-logging`, etc.) which can be individually tweaked if you want to, but many people
17+
Setting `debug = true` turns on many different debug options (e.g., `debug-assertions`,
18+
`debug-logging`, etc.) which can be individually tweaked if you want to, but many people
1919
simply set `debug = true`. Check out the comments in config.toml.example for more info.
2020

21-
You will need to rebuild the compiler once you've changed any configuration options.
21+
You will need to rebuild the compiler once you've changed any configuration options.
2222

2323
## `-Z` flags
2424

@@ -38,7 +38,7 @@ normal Rust programs. IIRC backtraces **don't work** on MinGW,
3838
sorry. If you have trouble or the backtraces are full of `unknown`,
3939
you might want to find some way to use Linux, Mac, or MSVC on Windows.
4040

41-
In the default configuration (without `debug` set to `true`), you don't have line numbers
41+
In the default configuration (without `debug` set to `true`), you don't have line numbers
4242
enabled, so the backtrace looks like this:
4343

4444
```text
@@ -58,7 +58,7 @@ stack backtrace:
5858
37: rustc_driver::run_compiler
5959
```
6060

61-
If you set `debug = true`, you will get line numbers for the stack trace.
61+
If you set `debug = true`, you will get line numbers for the stack trace.
6262
Then the backtrace will look like this:
6363

6464
```text

src/compiler-src.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
> top-level directory has separate directories for the compiler, build-system,
88
> std libs, etc, rather than one huge `src/` directory.
99
>
10-
> As of this writing, the std libs have been moved to `library/` and the crates
10+
> As of January 2021, the std libs have been moved to `library/` and the crates
1111
> that make up the `rustc` compiler itself have been moved to `compiler/`
1212
1313
Now that we have [seen what the compiler does](./overview.md), let's take a

src/mir/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ but [you can read about those below](#promoted)).
230230
- **Statements** are represented by the type [`Statement`].
231231
- **Terminators** are represented by the [`Terminator`].
232232
- **Locals** are represented by a [newtype'd] index type [`Local`].
233-
The data for a local variable is found in the
233+
The data for a local variable is found in the
234234
[`Body::local_decls`][localdecls] vector). There is also a special constant
235235
[`RETURN_PLACE`] identifying the special "local" representing the return value.
236236
- **Places** are identified by the enum [`Place`]. There are a few

src/queries/query-evaluation-model-in-detail.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
# The Query Evaluation Model in Detail
42

53
<!-- toc -->

src/stabilization_guide.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Once an unstable feature has been well-tested with no outstanding
44
concern, anyone may push for its stabilization. It involves the
5-
following steps.
5+
following steps:
66

77
<!-- toc -->
88

src/traits/goals-and-clauses.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ it is okay to assume `FromEnv(T: Clone)` in the `loud_clone` example is that we
198198
_also_ verify `WellFormed(T: Clone)` for each call site of `loud_clone`.
199199
Similarly, it is okay to assume `FromEnv(HashSet<K>)` in the `loud_insert`
200200
example because we will verify `WellFormed(HashSet<K>)` for each call site of
201-
`loud_insert`.
201+
`loud_insert`.
202202

203203
#### Outlives(Type: Region), Outlives(Region: Region)
204204
e.g. `Outlives(&'a str: 'b)`, `Outlives('a: 'static)`

src/ty.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ There are many variants on the `TyKind` enum, which you can see by looking at it
191191
- [**Array**][kindarray] Corresponds to `[T; n]`.
192192
- [**RawPtr**][kindrawptr] Corresponds to `*mut T` or `*const T`.
193193
- [**Ref**][kindref] `Ref` stands for safe references, `&'a mut T` or `&'a T`. `Ref` has some
194-
associated parts, like `Ty<'tcx>` which is the type that the reference references.
194+
associated parts, like `Ty<'tcx>` which is the type that the reference references.
195195
`Region<'tcx>` is the lifetime or region of the reference and `Mutability` if the reference
196196
is mutable or not.
197197
- [**Param**][kindparam] Represents a type parameter (e.g. the `T` in `Vec<T>`).

0 commit comments

Comments
 (0)