-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Return nonzero exit code if there are errors at a stop point #22117
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
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Can you add some kind of test for this? |
c1cc39f
to
476a3c6
Compare
@nikomatsakis #22118 contains a bunch of test cases for this. Since those are the intended use it may be hard to dig up other relevant test cases. |
@nikomatsakis @brson yes, I would like to add the |
476a3c6
to
9e6190d
Compare
After making `rustc` fail on errors at a stop point, like `-Z parse-only`, in rust-lang#22117, the files in this PR also fail during the parse stage and should be moved as well. Sorry for spliting this move up in two PRs.
9e6190d
to
e941932
Compare
@brson what do you think about the new approach? Is it more reasonable? |
Needs rebase |
be1ba0d
to
f29b4d7
Compare
Thanks, I have rebased the PR. |
☔ The latest upstream changes (presumably #23331) made this pull request unmergeable. Please resolve the merge conflicts. |
I have resolved the merge conflicts. |
☔ The latest upstream changes (presumably #23654) made this pull request unmergeable. Please resolve the merge conflicts. |
rebased this PR again |
☔ The latest upstream changes (presumably #23930) made this pull request unmergeable. Please resolve the merge conflicts. |
@@ -8,4 +8,6 @@ | |||
// option. This file may not be copied, modified, or distributed | |||
// except according to those terms. | |||
|
|||
// compile-flags: -Z parse-only |
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.
can this be globally added to parse-fail
rather than in each test file?
r+ @fhahn I just realized you've been dutifully rebasing this PR and I didn't notice at all. I apologize for that. In any case, I think it seems clearly good! |
(Unfortunately, it does need to be rebased again...) |
@nikomatsakis no worries, all rebases were very minimal & straightforward |
@bors r=nikomatsakis |
📌 Commit 2a24e97 has been approved by |
At the moment, when compilation is stopped at a stop point (like `-Z parse-only`), `rustc` does not return an nonzero exit code even if there are errors (expect fatal ones, that cause it to panic immediately). As an example, compiling `src/test/compile-fail/doc-before-semi.rs` with `-Z parse-only` raises an error, but exists with 0. Note that I could not use `sess.abort_if_errors()` in the macro, because `sess` is passed by value and move at some point.
At the moment, when compilation is stopped at a stop point (like
-Z parse-only
),rustc
does not return an nonzero exit code even if there are errors (expect fatal ones, that cause it to panic immediately). As an example, compilingsrc/test/compile-fail/doc-before-semi.rs
with-Z parse-only
raises an error, but exists with 0.Note that I could not use
sess.abort_if_errors()
in the macro, becausesess
is passed by value and move at some point.