Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -Ztrack-diagnostics information #1506

Merged
merged 2 commits into from
Dec 17, 2022
Merged

Add -Ztrack-diagnostics information #1506

merged 2 commits into from
Dec 17, 2022

Conversation

mejrs
Copy link
Contributor

@mejrs mejrs commented Nov 5, 2022

Followup to rust-lang/rust#103217

`-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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not add this since what follows is not shell code, just console output... would indeed be nice to have colors matching rustc error messages.

Copy link
Contributor Author

@mejrs mejrs Nov 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with consistency with the treat-bug-as-err example above, which also uses bash syntax to set env variables

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may fix that as well if you like

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not separate commands and their outputs as you did, especially since it does not help with highlighting at all. I can make the changes for you, if you feel like this is too much back-n-forth.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay - I somewhat forgot about this Pr. I think the current separation is fine. Feel free to change it if you disagree.

@@ -287,6 +287,8 @@ There are two 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Invoking `rustc` with the nightly-only flag `-Z track-diagnostics` will print error creation
- Invoking `rustc` with the nightly-only flag, `-Z track-diagnostics`, will print error creation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that makes sense, but I'm not a native speaker. I went for consistency with treat-bug-as-err, which does not have commas in this position.

Copy link
Member

@tshepang tshepang Nov 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can, alternatively, do this (which avoids the commas)...

Invoking rustc with -Z track-diagnostics will print error creation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that is much nicer

@JohnTitor JohnTitor added the S-waiting-on-author Status: this PR is waiting for additional action by the OP label Nov 18, 2022
src/compiler-debugging.md Outdated Show resolved Hide resolved
src/compiler-debugging.md Outdated Show resolved Hide resolved
src/compiler-debugging.md Outdated Show resolved Hide resolved
@tshepang
Copy link
Member

tshepang commented Dec 17, 2022

GitHub ui failed me here, and does not seem to offer a way to fix it... @mejrs will you please fix my mess (replace the missing backticks on the code blocks). Please rebase as well.

@mejrs mejrs force-pushed the track branch 2 times, most recently from 0a337f0 to 776f114 Compare December 17, 2022 21:51
@mejrs
Copy link
Contributor Author

mejrs commented Dec 17, 2022

Done. I'm not sure I understood what you wanted though...

@tshepang tshepang merged commit 8b42eb5 into rust-lang:master Dec 17, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 19, 2022
Update books

## rust-lang/nomicon

1 commits in ae406aa5287a9e025abb72343aaceec98458c117..dd37e21ccee43918ed18a71581bb2af537ffe4fc
2022-12-09 22:04:38 UTC to 2022-12-09 22:04:38 UTC

- Update lifetime-mismatch.md (rust-lang/nomicon#387)

## rust-lang/rust-by-example

3 commits in a9869b4a3c4cac3bc6099b41f088679e268400b8..995df09b65c582eb6290ab7ea5d9485983eb4c37
2022-12-08 23:29:31 UTC to 2022-12-08 23:28:31 UTC

- Add documentation for let-else. (rust-lang/rust-by-example#1640)
- Added missing space in comment (rust-lang/rust-by-example#1644)
- Clean up Chapter 1 (Hello World) (rust-lang/rust-by-example#1650)

## rust-lang/rustc-dev-guide

8 commits in e269950..8b42eb5
2022-12-17 22:41:27 UTC to 2022-12-07 05:42:57 UTC

- Add -Ztrack-diagnostics information (rust-lang/rustc-dev-guide#1506)
- Add documentation for LLVM KCFI support (rust-lang/rustc-dev-guide#1529)
- Replace references to NoLandingPads in MIR pass documents (rust-lang/rustc-dev-guide#1531)
- share same link (rust-lang/rustc-dev-guide#1530)
- chore: Update `actions/github-script` to v6 (rust-lang/rustc-dev-guide#1521)
- fix: Fix broken links (rust-lang/rustc-dev-guide#1522)
- Remove TyS (rust-lang/rustc-dev-guide#1526)
- Fix small inaccuracy in monomorph page (rust-lang/rustc-dev-guide#1525)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: this PR is waiting for additional action by the OP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants