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

bootstrap: --warnings warn doesn't apply to bootstrap itself #76805

Closed
matthiaskrgr opened this issue Sep 16, 2020 · 2 comments · Fixed by #112089
Closed

bootstrap: --warnings warn doesn't apply to bootstrap itself #76805

matthiaskrgr opened this issue Sep 16, 2020 · 2 comments · Fixed by #112089
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Sep 16, 2020

Bootstrapping with RUSTFLAGS="-Wsomething that warns ./x.py check --warnings warn does not work; a warning inside bootstrap will still abort the compilation process:

error: trivial numeric cast: `u32` as `u32`
   --> src/bootstrap/lib.rs:156:31
    |
156 |             libc::setpriority(libc::PRIO_PGRP as _, 0, 10);
    |                               ^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D trivial-numeric-casts` implied by `-D warnings`
    = help: cast can be replaced by coercion; this might require a temporary variable

error: aborting due to previous error

error: could not compile `bootstrap`.

EDIT: well, putting --cap-lints warn into RUSTFLAGS works but it seems very unintuitive.

@jyn514 jyn514 added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. labels Sep 16, 2020
@Mark-Simulacrum
Copy link
Member

x.py doesn't check the warnings flag, but you can set deny-warnings in config.toml to false to patch around this.

@jyn514 jyn514 changed the title rustbuild: can't --cap-lints warn with x.py --warnings warn bootstrap: --warnings warn doesn't apply to bootstrap itself Feb 3, 2023
@jyn514
Copy link
Member

jyn514 commented Feb 3, 2023

Mentoring instructions: Add a --warnings flag to bootstrap.py around

def parse_args():
"""Parse the command line arguments that the python script needs."""
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('-h', '--help', action='store_true')
parser.add_argument('--config')
parser.add_argument('--build-dir')
parser.add_argument('--build')
parser.add_argument('--color', choices=['always', 'never', 'auto'])
parser.add_argument('--clean', action='store_true')
parser.add_argument('-v', '--verbose', action='count', default=0)
and check it when building bootstrap, around
if self.use_locked_deps:
args.append("--locked")
if self.use_vendored_sources:
args.append("--frozen")
if self.get_toml("metrics", "build"):
args.append("--features")
args.append("build-metrics")
if color == "always":
args.append("--color=always")
elif color == "never":
args.append("--color=never")

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue May 31, 2023
Add `--warnings warn` flag to `x.py`

So that bootstrap itself can be built with warnings not being treated as errors.

Fixes: rust-lang#76805

r? `@jyn514`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue May 31, 2023
Add `--warnings warn` flag to `x.py`

So that bootstrap itself can be built with warnings not being treated as errors.

Fixes: rust-lang#76805

r? ``@jyn514``
@bors bors closed this as completed in 9e108f8 May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants