Skip to content

Commit

Permalink
Apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mejrs authored and tshepang committed Dec 17, 2022
1 parent a213de4 commit 8b42eb5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/compiler-debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ fn main() {
}
```

```bash
```
$ rustc +stage1 error.rs
error[E0277]: cannot add `()` to `{integer}`
--> error.rs:2:7
Expand All @@ -143,7 +143,7 @@ error: aborting due to previous error

Now, where does the error above come from?

```bash
```
$ RUST_BACKTRACE=1 rustc +stage1 error.rs -Z treat-err-as-bug
error[E0277]: the trait bound `{integer}: std::ops::Add<()>` is not satisfied
--> error.rs:2:7
Expand Down Expand Up @@ -190,7 +190,7 @@ Cool, now I have a backtrace for the error!
`-Z track-diagnostics` can help figure out where errors are emitted. It uses `#[track_caller]`
for this and prints its location alongside the error:

```bash
```
$ RUST_BACKTRACE=1 rustc +stage1 error.rs -Z track-diagnostics
error[E0277]: cannot add `()` to `{integer}`
--> src\error.rs:2:7
Expand Down
2 changes: 1 addition & 1 deletion src/diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ There are three main ways to find where a given error is emitted:
- The _construction_ of the error is far away from where it is _emitted_,
a problem similar to the one we faced with the `grep` approach.
In some cases, we buffer multiple errors in order to emit them in order.
- Invoking `rustc` with the nightly-only flag `-Z track-diagnostics` will print error creation
- Invoking `rustc` with `-Z track-diagnostics` will print error creation
locations alongside the error.

The regular development practices apply: judicious use of `debug!()` statements
Expand Down

0 comments on commit 8b42eb5

Please sign in to comment.