-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
very minor cleanups #111606
very minor cleanups #111606
Conversation
r? @lcnr (rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
4a1f8c1
to
666d183
Compare
// the error code is already going to be reported when the panic unwinds up the stack | ||
let _ = early_error_no_abort(ErrorOutputType::default(), &msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this does the right thing as follows:
C:\Users\jyn\src\rust2>(rustc -C help || call echo %%^^errorlevel%% 1>&2) | cmd /c exit
error: failed printing to stdout: The pipe is being closed. (os error 232)
%101%
@@ -1741,6 +1741,7 @@ fn early_error_handler(output: config::ErrorOutputType) -> rustc_errors::Handler | |||
|
|||
#[allow(rustc::untranslatable_diagnostic)] | |||
#[allow(rustc::diagnostic_outside_of_impl)] | |||
#[must_use = "ErrorGuaranteed does nothing unless returned from build_session_options"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that feels a bit weird to me 🤔 what do you mean with "does nothing unless"?
ErrorGuaranteed
never does anything, I thought it is only meant to be used as a token for "we already errored, so feel free to skip some other errors or checks".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ErrorGuaranteed is used in rustc_driver to determine whether to exit with a success status code or not: https://github.com/rust-lang/rust/blob/666d1831c5a4215165f37417bda6667f27ef7790/compiler/rustc_driver_impl/src/lib.rs#L1386-L1399
If someone forgets to return ErrorGuaranteed from run_compiler
, we'll exit with a 0 status code even though we emitted an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, this feels generally a bit sketchy, I see why you'd want to use #[must_use]
now.
could anything that have an TyCtxt
instead check for has_errors()
? or I guess sess.has_errors()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ErrorGuaranteed is used in rustc_driver to determine whether to exit with a success status code or not:
can you put that as part of the #[must_use]
explanation?
r=me after that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could anything that have an TyCtxt instead check for has_errors()? or I guess sess.has_errors()?
all the callers of early_error
and early_error_no_abort
happen before we construct a sess
(otherwise they could just call sess.err
or sess.fatal
).
can you put that as part of the #[must_use] explanation?
👍 will do :)
☔ The latest upstream changes (presumably #111710) made this pull request unmergeable. Please resolve the merge conflicts. |
666d183
to
464fd0c
Compare
- add `must_use` to `early_error_no_abort` this was already being used at its only callsite, but this ensures that new code remembers to use it if it's called in the future. - remove outdated and incorrect comment in `builder.rs`. `doc_rust_lang_org_channel` doesn't exist in rustdoc, it gets it from an env var instead.
464fd0c
to
0426562
Compare
@bors r=lcnr rollup |
very minor cleanups - add `must_use` to `early_error_no_abort` this was already being used at its only callsite, but this ensures that new code remembers to use it if it's called in the future. found this while investigating rust-lang#110090. - remove outdated and incorrect comment in `builder.rs`. `doc_rust_lang_org_channel` doesn't exist in rustdoc, it gets it from an env var instead: https://github.com/rust-lang/rust/blob/b275d2c30b6e88cc48747f349f7137076d450658/src/librustdoc/clean/utils.rs#L569-L573
very minor cleanups - add `must_use` to `early_error_no_abort` this was already being used at its only callsite, but this ensures that new code remembers to use it if it's called in the future. found this while investigating rust-lang#110090. - remove outdated and incorrect comment in `builder.rs`. `doc_rust_lang_org_channel` doesn't exist in rustdoc, it gets it from an env var instead: https://github.com/rust-lang/rust/blob/b275d2c30b6e88cc48747f349f7137076d450658/src/librustdoc/clean/utils.rs#L569-L573
very minor cleanups - add `must_use` to `early_error_no_abort` this was already being used at its only callsite, but this ensures that new code remembers to use it if it's called in the future. found this while investigating rust-lang#110090. - remove outdated and incorrect comment in `builder.rs`. `doc_rust_lang_org_channel` doesn't exist in rustdoc, it gets it from an env var instead: https://github.com/rust-lang/rust/blob/b275d2c30b6e88cc48747f349f7137076d450658/src/librustdoc/clean/utils.rs#L569-L573
very minor cleanups - add `must_use` to `early_error_no_abort` this was already being used at its only callsite, but this ensures that new code remembers to use it if it's called in the future. found this while investigating rust-lang#110090. - remove outdated and incorrect comment in `builder.rs`. `doc_rust_lang_org_channel` doesn't exist in rustdoc, it gets it from an env var instead: https://github.com/rust-lang/rust/blob/b275d2c30b6e88cc48747f349f7137076d450658/src/librustdoc/clean/utils.rs#L569-L573
Rollup of 10 pull requests Successful merges: - rust-lang#111491 (Dont check `must_use` on nested `impl Future` from fn) - rust-lang#111606 (very minor cleanups) - rust-lang#111619 (Add timings for MIR passes to profiling report) - rust-lang#111652 (Better diagnostic for `use Self::..`) - rust-lang#111665 (Add more tests for the offset_of macro) - rust-lang#111708 (Give a more useful location for where a span_bug was delayed) - rust-lang#111715 (Fix doc comment for `ConstParamTy` derive) - rust-lang#111723 (style: do not overwrite obligations) - rust-lang#111743 (Improve cgu merging debug output) - rust-lang#111762 (fix: emit error when fragment is `MethodReceiverExpr` and items is empty) r? `@ghost` `@rustbot` modify labels: rollup
add
must_use
toearly_error_no_abort
this was already being used at its only callsite, but this ensures that new code remembers to use it if it's called in the future. found this while investigating stable: Give a better error message for
rustc +nightly -Zunstable-options
#110090.remove outdated and incorrect comment in
builder.rs
.doc_rust_lang_org_channel
doesn't exist in rustdoc, it gets it from an env var instead:rust/src/librustdoc/clean/utils.rs
Lines 569 to 573 in b275d2c