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 -Z dont-buffer-diagnostics #54232

Merged

Conversation

pnkfelix
Copy link
Member

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
Collaborator

r? @eddyb

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

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

eddyb commented Sep 14, 2018

r? @nikomatsakis

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb Sep 14, 2018
/// Either immediate signals the given diagnostic, or puts it on the
/// given `buffer` for later signalling in the future.
pub fn buffer(self, mut diag: DiagnosticBuilder, buffer: &mut Vec<Diagnostic>) {
if self.sess.opts.debugging_opts.dont_buffer_diagnostics {
Copy link
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:

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

I've applied this patch myself numerous times.

Copy link
Contributor

@nikomatsakis nikomatsakis Sep 14, 2018

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.

Copy link
Member Author

@pnkfelix pnkfelix Sep 14, 2018

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)

@@ -457,7 +457,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
}
}

err.buffer(&mut self.errors_buffer);
self.tcx.buffer(err, &mut self.errors_buffer);
Copy link
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 pnkfelix force-pushed the add-way-to-disable-diagnostic-buffering branch from d5d957d to d466964 Compare September 15, 2018 04:29
@pnkfelix pnkfelix changed the title Add -Z dont-buffer-diagnostics [WIP] Add -Z dont-buffer-diagnostics Sep 17, 2018
@pnkfelix
Copy link
Member Author

pnkfelix commented Sep 17, 2018

(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 pnkfelix force-pushed the add-way-to-disable-diagnostic-buffering branch from d466964 to 82e1750 Compare September 17, 2018 12:30
@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Sep 17, 2018

📋 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
Contributor

@bors rollup

@nikomatsakis nikomatsakis changed the title [WIP] Add -Z dont-buffer-diagnostics add -Z dont-buffer-diagnostics Sep 17, 2018
@nikomatsakis
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 17, 2018

📌 Commit 82e1750 has been approved by nikomatsakis

@bors bors 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:master Sep 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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: 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