Skip to content

Commit

Permalink
Apply more feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mejrs committed Dec 17, 2022
1 parent a78f33e commit 0a337f0
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/compiler-debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,9 @@ fn main() {
}
```

```bash
$ rustc +stage1 error.rs
```
$ rustc +stage1 error.rs
```text
error[E0277]: cannot add `()` to `{integer}`
--> error.rs:2:7
|
Expand All @@ -146,11 +144,10 @@ 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
```
$ RUST_BACKTRACE=1 rustc +stage1 error.rs -Z treat-err-as-bug
```text
error[E0277]: the trait bound `{integer}: std::ops::Add<()>` is not satisfied
--> error.rs:2:7
|
Expand Down Expand Up @@ -196,11 +193,9 @@ 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
```
$ RUST_BACKTRACE=1 rustc +stage1 error.rs -Z track-diagnostics
```text
error[E0277]: cannot add `()` to `{integer}`
--> src\error.rs:2:7
|
Expand Down

0 comments on commit 0a337f0

Please sign in to comment.