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

Set default value deny-warnings for compiler profile to false #124439

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

WaffleLapkin
Copy link
Member

yea

@rustbot
Copy link
Collaborator

rustbot commented Apr 27, 2024

r? @albertlarsan68

rustbot has assigned @albertlarsan68.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Apr 27, 2024
@rustbot
Copy link
Collaborator

rustbot commented Apr 27, 2024

This PR modifies src/bootstrap/defaults.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@Noratrieb
Copy link
Member

i strongly second this, i find deny-warnings extremely frustrating and it is quite possible that not knowing how to turn it off for a bit longer would have made me stop contributing. i think we should strive to have the same defaults here as rust in general, and there's a good reason why in a default cargo projects, warnings aren't denied by default.

@Noratrieb
Copy link
Member

doing it just in the compiler profile is a bit silly though, it should be the default for everyone

@compiler-errors
Copy link
Member

I'm pretty against this. We definitely shouldn't allow PRs to be merged with outstanding warnings, so of course, in practice this will just move errors from local builds to CI.

@Noratrieb
Copy link
Member

@compiler-errors so you use and like deny-warnings = true? i can see why it's useful and why it exists, I just think it's the wrong default, among other reasons because it's not the default in rust generally.

@compiler-errors
Copy link
Member

Yep -- it definitely catches a significant number of logical errors that I would otherwise ignore if I saw a string of warnings being emitted during my build. Especially bc I usually chain ./x.py build && rustc +local test_file.rs.

Also I'm not certain whether "default for everyone" also includes allowing warnings to pass the final bors-merge and make it to master -- I assume it doesn't.

@Noratrieb
Copy link
Member

it would definitely not involve making it pass CI, denying it in CI is very important :D
yeah this is always a hotly contended topic because it seems like there are two extremes, those who really want the warnings denied and those who cannot work with them denied
given that, maybe it should be an option one is explicitly asked in x setup? I am always very wary of adding new questions there, but this does seem pretty important to me

@compiler-errors
Copy link
Member

given that, maybe it should be an option one is explicitly asked in x setup? I am always very wary of adding new questions there, but this does seem pretty important to me

yeah, I think this would be the best compromise. Something that explains the tradeoff (and also warns that if they disable them locally then they may fail CI, so still fix them before they put up a PR).

@albertlarsan68
Copy link
Member

Also, the build process is quite verbose, so if you leave the build in the background, the warnings may be way up in the terminal, but I can see the annoyance of some of the "less important" warnings, as the "mut var not mutated", for which fixing it can mean rebuilding the whole compiler, which can be long. Why not make discuss it at the next T-compiler meeting? (not really sure what the process is)

@jyn514
Copy link
Member

jyn514 commented May 10, 2024

while you're at it it would be nice to make changing the value of deny-warnings not rebuild the compiler, could inject it in the rustc shim so cargo doesn't know about it

(my understanding is @epage is working on upstream support for this in cargo, but in the meantime)

@epage
Copy link
Contributor

epage commented May 10, 2024

I'm assuming @jyn514 is referring to rust-lang/cargo#8424.

As an outsider, warnings failing during development are a major hindrance to experimenting and should be limited to CI. Yes, it only fails on CI but the user was generally warned CI will fail, no pun intended. This is how most projects I interact with operate, so its not unheard of precedence.

@jyn514
Copy link
Member

jyn514 commented May 10, 2024

the user was generally warned CI will fail

this is what we talked about yesterday, remember - for large workspaces the warnings often get lost: rust-lang/cargo#8749
you suggested fixing that by having the progress messages only take up a single line instead, which i thought was a fabulous idea: rust-lang/cargo#8889

@WaffleLapkin
Copy link
Member Author

@compiler-errors thanks for providing your point of view, it differs from mine and so is interesting and useful to hear.

In my experience most warnings are not important, I usually get things like "unused import/function/variable/mut" while experimenting (especially unused import, I get this a lot since r-a auto adds imports but does not remove them automatically). And for those kinds of warnings it is silly to require rebuilding everything (fixing them require changing code, which causes a rebuild). This can be especially painful for contributors with ""low spec"" hardware, for whom a rebuild is a lot of time. (additionally denying warnings can fail compilation too early, not letting the compiler get to other warnings, in other crates)

As @Nilstrieb and @epage said already, it is common practice to deny warnings only in CI, to allow easier experimentation locally.

I can see the point that with the current system warnings can be easily lost. IMO a "CI fails with warnings, local has a warning summary at the end" would be ideal (summary referring to rust-lang/cargo#8749 (it's 4 years old, oof)).

As things stand, I think "x setup has a question about this" would be fine as well. (I do not have capacity to implement this though, is anyone up to this?)

@bors
Copy link
Contributor

bors commented Jun 16, 2024

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

@albertlarsan68 albertlarsan68 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants