Skip to content

add -Z dont-buffer-diagnostics - #54232

Merged
bors merged 1 commit into
rust-lang:masterfrom
pnkfelix:add-way-to-disable-diagnostic-buffering
Sep 18, 2018
Merged

add -Z dont-buffer-diagnostics#54232
bors merged 1 commit into
rust-lang:masterfrom
pnkfelix:add-way-to-disable-diagnostic-buffering

Conversation

@pnkfelix

Copy link
Copy Markdown
Contributor

Add -Z dont-buffer-diagnostics, a way to force NLL to immediately its diagnostics.

This is mainly intended for developers who want to see the error in its original context in the control flow. Two uses cases for that are:

  1. -Z treat-err-as-bug (which then allows extraction of a stack-trace to the origin of the error)

  2. RUST_LOG=... rustc, in which case it is often useful to see the logging statements that occurred immediately prior to the point where the diagnostic was signalled.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 14, 2018
@eddyb

Copy link
Copy Markdown
Contributor

r? @nikomatsakis

Comment threadsrc/librustc/ty/context.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe this should check treat-err-as-bug and abort. And/or you could probably make this:

ifself.sess.opts.debugging_opts.treat_err_as_bug || self.sess.opts.debugging_opts.dont_buffer_diagnostics{

I've applied this patch myself numerous times.

@nikomatsakisnikomatsakisSep 14, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh, wait, no I haven't. I think this function is in the wrong place. This code can live in buffer() -- it has access to the Handler, which has the field flags (of type HandlerFlags) that contain flags relevant to it. We can just add this flag in there.

@pnkfelixpnkfelixSep 14, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ok will do (probably on Monday)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

all these diffs aren't needed then

@pnkfelix
pnkfelixforce-pushed the add-way-to-disable-diagnostic-buffering branch from d5d957d to d466964CompareSeptember 15, 2018 04:29
@pnkfelixpnkfelix changed the title Add -Z dont-buffer-diagnostics[WIP] Add -Z dont-buffer-diagnosticsSep 17, 2018
@pnkfelix

pnkfelix commented Sep 17, 2018

Copy link
Copy Markdown
ContributorAuthor

(this does not seem to yet work in the manner I intended.)

Update: 🤕 while incorporating review feedback, I felt out crucial invocation of .emit()

…t its diagnostics.
This is mainly intended for `rustc` developers who want to see a
diagnostic in its original context in the control flow. Two uses
cases for that are:
* `-Z treat-err-as-bug` which then allows extraction of a stack-trace to the origin of the error
(a case that is so important that we make that flag imply this one, effectively).
* `RUST_LOG=... rustc`, in which case it is often useful to see the logging statements that
occurred immediately prior to the point where the diagnostic was signalled.
Drive-by: Added some documentation pointing future devs at
HandlerFlags, and documented the fields of `HandlerFlags` itself.
@pnkfelix
pnkfelixforce-pushed the add-way-to-disable-diagnostic-buffering branch from d466964 to 82e1750CompareSeptember 17, 2018 12:30
@nikomatsakis

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Sep 17, 2018

Copy link
Copy Markdown
Collaborator

📋 Looks like this PR is still in progress, ignoring approval.

Hint: Remove [WIP] from this PR's title when it is ready for review.

@nikomatsakis

Copy link
Copy Markdown
Contributor

@bors rollup

@nikomatsakisnikomatsakis changed the title [WIP] Add -Z dont-buffer-diagnosticsadd -Z dont-buffer-diagnosticsSep 17, 2018
@nikomatsakis

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@bors

bors commented Sep 17, 2018

Copy link
Copy Markdown
Collaborator

📌 Commit 82e1750 has been approved by nikomatsakis

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 17, 2018
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Sep 18, 2018
…tic-buffering, r=nikomatsakis
add `-Z dont-buffer-diagnostics`
Add `-Z dont-buffer-diagnostics`, a way to force NLL to immediately its diagnostics.
This is mainly intended for developers who want to see the error in its original context in the control flow. Two uses cases for that are:
1. `-Z treat-err-as-bug` (which then allows extraction of a stack-trace to the origin of the error)
2. RUST_LOG=... rustc, in which case it is often useful to see the logging statements that occurred immediately prior to the point where the diagnostic was signalled.
bors added a commit that referenced this pull request Sep 18, 2018
Rollup of 9 pull requests
Successful merges:
- #53522 (Add doc for impl From for Addr)
- #54097 (rustdoc: Remove namespace for keywords)
- #54205 (Add treat-err-as-bug flag in rustdoc)
- #54225 (Regression test for #53675.)
- #54232 (add `-Z dont-buffer-diagnostics`)
- #54273 (Suggest to change numeric literal instead of casting)
- #54299 (Issue 54246)
- #54311 (Remove README with now-out-of-date docs about docs.)
- #54313 (OsStr: Document that it's not NUL terminated)
Failed merges:
r? @ghost
@bors
bors merged commit 82e1750 into rust-lang:masterSep 18, 2018
nnethercote added a commit to nnethercote/rust that referenced this pull request Jan 7, 2024
It was added in rust-lang#54232. It seems like it was aimed at NLL development,
which is well in the past. Also, it looks like `-Ztreat-err-as-bug` can
be used to achieve the same effect. So it doesn't seem necessary.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 8, 2024
…stics, r=compiler-errors
Remove `-Zdont-buffer-diagnostics`.
It was added in rust-lang#54232. It seems like it was aimed at NLL development, which is well in the past. Also, it looks like `-Ztreat-err-as-bug` can be used to achieve the same effect. So it doesn't seem necessary.
r? `@pnkfelix`
nnethercote added a commit to nnethercote/rust that referenced this pull request Jan 8, 2024
It was added in rust-lang#54232. It seems like it was aimed at NLL development,
which is well in the past. Also, it looks like `-Ztreat-err-as-bug` can
be used to achieve the same effect. So it doesn't seem necessary.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jan 9, 2024
…stics, r=compiler-errors
Remove `-Zdont-buffer-diagnostics`.
It was added in rust-lang#54232. It seems like it was aimed at NLL development, which is well in the past. Also, it looks like `-Ztreat-err-as-bug` can be used to achieve the same effect. So it doesn't seem necessary.
r? `@pnkfelix`
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jan 9, 2024
…stics, r=compiler-errors
Remove `-Zdont-buffer-diagnostics`.
It was added in rust-lang#54232. It seems like it was aimed at NLL development, which is well in the past. Also, it looks like `-Ztreat-err-as-bug` can be used to achieve the same effect. So it doesn't seem necessary.
r? ``@pnkfelix``
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 9, 2024
Rollup merge of rust-lang#119723 - nnethercote:rm-Zdont-buffer-diagnostics, r=compiler-errors
Remove `-Zdont-buffer-diagnostics`.
It was added in rust-lang#54232. It seems like it was aimed at NLL development, which is well in the past. Also, it looks like `-Ztreat-err-as-bug` can be used to achieve the same effect. So it doesn't seem necessary.
r? ``@pnkfelix``
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@pnkfelix@rust-highfive@eddyb@nikomatsakis@bors