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

Deny warnings in libcore and libstd #57184

Merged
merged 1 commit into from
Feb 9, 2019
Merged

Conversation

varkor
Copy link
Member

@varkor varkor commented Dec 28, 2018

This probably fixes #57178 (though there may still be some crates that need warnings denied). At least after this change, rustc currently produces no warnings during compilation.

r? @oli-obk

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

ollie27 commented Dec 28, 2018

rustbuild handles denying warnings. If you want to deny warnings when building std at stage 0 then this exception needs to be removed:

rust/src/bootstrap/builder.rs

Lines 999 to 1002 in 79d8a0f

// in std, we want to avoid denying warnings for stage 0 as that makes cfg's painful.
if self.config.deny_warnings && !(mode == Mode::Std && stage == 0) {
cargo.env("RUSTC_DENY_WARNINGS", "1");
}

@Mark-Simulacrum
Copy link
Member

I think we shouldn't remove the exception. I could be convinced that if the max-stage to be built is not 0 then we should do something like -Awarnings but I don't personally care that much.

@varkor
Copy link
Member Author

varkor commented Dec 29, 2018

Ah, I didn't realise this was a deliberate decision. What sort of situations does it make painful? In my experience warnings are usually fixed quite quickly: at worst, it's a #[cfg_attr(stage0, ...)] away, which seems better than printing a load of warning messages.

@oli-obk
Copy link
Contributor

oli-obk commented Dec 29, 2018

There's very little point to these kind of warnings (they'll go away when the next beta comes around). While any other kind of warning will be caught at stage 1, it makes for a bad user experience when modifying libstd and only seeing warnings at stage 1 (Since running tests requires stage 1). So I think we should neither silence the warnings nor deny them and just keep the status quo.

What sort of situations does it make painful? In my experience warnings are usually fixed quite quickly: at worst, it's a #[cfg_attr(stage0, ...)] away, which seems better than printing a load of warning messages.

It's annoying when you change the compiler so that you need to change libstd, too, and run everything with --keep-stage 0, because everything else would take forever. Now when everything works and you go back to building without keep-stage, suddenly everything breaks and you need to add cfgs. These changes are just noise though, since they'll go away with the next boostrap update.

You can also run into error/warning pingpong between stage 0 and stage 1, because the changes you do to get stage 0 to work end up bricking stage 1

@varkor
Copy link
Member Author

varkor commented Dec 29, 2018

Those problems could be addressed by adding a config.toml option or compiler flag to disable #[deny(warnings)] on stage 0, which is not used on the testing infrastructure. This would mean that developers would potentially have one extra step at the end of a change — recompiling with stage 0 and conditionally cfging any warnings that did appear, but it would mean the compiler is always warning-free.

The philosophy of not (implicitly) ignoring warnings seems like a sensible one, even if warnings per se shouldn't be as worrying as errors.

@Mark-Simulacrum
Copy link
Member

Adding another option seems fine. I'm pretty neutral on this overall, just don't want to go back to unconditionally denying warnings inside core/std directly (it should be a rustbuild thing).

@varkor
Copy link
Member Author

varkor commented Dec 30, 2018

Okay, I'll update the pull request soon.

@varkor varkor force-pushed the deny-warnings-lib branch from d404af6 to 0e54bdf Compare January 3, 2019 13:00
@varkor
Copy link
Member Author

varkor commented Jan 3, 2019

I've added a allow-stage0-warnings = false config.toml option. This should allow for the existing methodology of ignoring warnings until after development, when the stage 0 warnings can be cfg'd out, but will also mean we don't accidentally permit bad behaviour in stage 0.

r? @Mark-Simulacrum

@varkor varkor assigned Mark-Simulacrum and unassigned oli-obk Jan 3, 2019
@bors
Copy link
Contributor

bors commented Jan 17, 2019

☔ The latest upstream changes (presumably #57670) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Jan 29, 2019

☔ The latest upstream changes (presumably #57957) made this pull request unmergeable. Please resolve the merge conflicts.

@varkor varkor force-pushed the deny-warnings-lib branch from 0e54bdf to c9ada9f Compare February 8, 2019 15:45
@varkor varkor force-pushed the deny-warnings-lib branch from c9ada9f to 5f41f8b Compare February 8, 2019 15:46
@varkor
Copy link
Member Author

varkor commented Feb 8, 2019

@Mark-Simulacrum: I've updated the pull request to unconditionally deny stage 0 std warnings, as we discussed. (For context, if someone wants to silence these warnings while developing, they can simply add #[cfg_attr(stage0, allow(warnings)] to libstd, so this doesn't make things much more convenient, while also meaning we won't overlook warnings that are not guaranteed to be spurious.)

@Mark-Simulacrum
Copy link
Member

Rustbuild wise this is good.

Cc @rust-lang/compiler

@bors r+

@bors
Copy link
Contributor

bors commented Feb 8, 2019

📌 Commit 5f41f8b has been approved by Mark-Simulacrum

@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 Feb 8, 2019
@bors
Copy link
Contributor

bors commented Feb 8, 2019

⌛ Testing commit 5f41f8b with merge 55294233e1edd1a6dbe25e3769045cad7003682a...

@bors
Copy link
Contributor

bors commented Feb 8, 2019

💔 Test failed - status-appveyor

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 8, 2019
@varkor
Copy link
Member Author

varkor commented Feb 8, 2019

@bors retry

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 8, 2019
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 8, 2019
@bors
Copy link
Contributor

bors commented Feb 9, 2019

⌛ Testing commit 5f41f8b with merge 312f382...

bors added a commit that referenced this pull request Feb 9, 2019
Deny warnings in libcore and libstd

This probably fixes #57178 (though there may still be some crates that need warnings denied). At least after this change, rustc currently produces no warnings during compilation.

r? @oli-obk
@bors
Copy link
Contributor

bors commented Feb 9, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: Mark-Simulacrum
Pushing 312f382 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 9, 2019
@bors bors merged commit 5f41f8b into rust-lang:master Feb 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

Some warnings are not errors when compiling rustc
6 participants