Move deny(warnings) into rustbuild

This permits easier iteration without having to worry about warnings
being denied.

Fixes #49517
This commit is contained in:
Mark Simulacrum 2018-04-01 09:35:53 -06:00
parent b7da1aaff6
commit c115cc655c
56 changed files with 26 additions and 63 deletions

View File

@ -339,6 +339,9 @@
# rustc to execute.
#lld = false
# Whether to deny warnings in crates
#deny-warnings = true
# =============================================================================
# Options for specific targets
#

View File

@ -279,6 +279,10 @@ fn main() {
cmd.arg("--color=always");
}
if env::var_os("RUSTC_DENY_WARNINGS").is_some() {
cmd.arg("-Dwarnings");
}
if verbose > 1 {
eprintln!("rustc command: {:?}", cmd);
eprintln!("sysroot: {:?}", sysroot);

View File

@ -698,6 +698,11 @@ impl<'a> Builder<'a> {
cargo.env("RUSTC_VERBOSE", format!("{}", self.verbosity));
// in std, we want to avoid denying warnings for stage 0 as that makes cfg's painful.
if self.config.deny_warnings && !(mode == Mode::Libstd && stage == 0) {
cargo.env("RUSTC_DENY_WARNINGS", "1");
}
// Throughout the build Cargo can execute a number of build scripts
// compiling C/C++ code and we need to pass compilers, archivers, flags, etc
// obtained previously to those build scripts.

View File

@ -71,6 +71,8 @@ pub struct Config {
pub incremental: bool,
pub dry_run: bool,
pub deny_warnings: bool,
// llvm codegen options
pub llvm_enabled: bool,
pub llvm_assertions: bool,
@ -301,6 +303,7 @@ struct Rust {
codegen_backends_dir: Option<String>,
wasm_syscall: Option<bool>,
lld: Option<bool>,
deny_warnings: Option<bool>,
}
/// TOML representation of how each build target is configured.
@ -340,6 +343,7 @@ impl Config {
config.test_miri = false;
config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")];
config.rust_codegen_backends_dir = "codegen-backends".to_owned();
config.deny_warnings = true;
// set by bootstrap.py
config.src = env::var_os("SRC").map(PathBuf::from).expect("'SRC' to be set");
@ -366,6 +370,9 @@ impl Config {
config.incremental = flags.incremental;
config.dry_run = flags.dry_run;
config.keep_stage = flags.keep_stage;
if let Some(value) = flags.warnings {
config.deny_warnings = value;
}
if config.dry_run {
let dir = config.out.join("tmp-dry-run");
@ -511,6 +518,7 @@ impl Config {
config.rustc_default_linker = rust.default_linker.clone();
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
set(&mut config.deny_warnings, rust.deny_warnings.or(flags.warnings));
if let Some(ref backends) = rust.codegen_backends {
config.rust_codegen_backends = backends.iter()

View File

@ -42,6 +42,9 @@ pub struct Flags {
pub exclude: Vec<PathBuf>,
pub rustc_error_format: Option<String>,
pub dry_run: bool,
// true => deny
pub warnings: Option<bool>,
}
pub enum Subcommand {
@ -118,6 +121,8 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
opts.optflag("h", "help", "print this help message");
opts.optopt("", "warnings", "if value is deny, will deny warnings, otherwise use default",
"VALUE");
opts.optopt("", "error-format", "rustc error format", "FORMAT");
// fn usage()
@ -374,6 +379,7 @@ Arguments:
incremental: matches.opt_present("incremental"),
exclude: split(matches.opt_strs("exclude"))
.into_iter().map(|p| p.into()).collect::<Vec<_>>(),
warnings: matches.opt_str("warnings").map(|v| v == "deny"),
}
}
}

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(warnings)]
use std::fs::File;
use std::path::{Path, PathBuf};

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(warnings)]
#![feature(rand)]
#![feature(repr_simd)]
#![feature(slice_sort_by_cached_key)]

View File

@ -72,7 +72,6 @@
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
#![no_std]
#![needs_allocator]
#![deny(warnings)]
#![deny(missing_debug_implementations)]
#![cfg_attr(test, allow(deprecated))] // rand

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(warnings)]
#![feature(allocator_api)]
#![feature(alloc_system)]
#![feature(attr_literals)]

View File

@ -14,7 +14,6 @@
reason = "this library is unlikely to be stabilized in its current \
form or name",
issue = "27783")]
#![deny(warnings)]
#![feature(alloc_system)]
#![feature(libc)]
#![feature(linkage)]

View File

@ -10,7 +10,6 @@
#![no_std]
#![allow(unused_attributes)]
#![deny(warnings)]
#![unstable(feature = "alloc_system",
reason = "this library is unlikely to be stabilized in its current \
form or name",

View File

@ -22,7 +22,6 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
test(no_crate_inject, attr(deny(warnings))))]
#![deny(warnings)]
#![feature(alloc)]
#![feature(core_intrinsics)]

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(warnings)]
#![feature(flt2dec)]
#![feature(test)]

View File

@ -63,7 +63,6 @@
#![no_core]
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(warnings)]
#![feature(allow_internal_unstable)]
#![feature(asm)]

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(warnings)]
#![feature(ascii_ctype)]
#![feature(box_syntax)]
#![feature(core_float)]

View File

@ -19,7 +19,6 @@
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/",
test(attr(deny(warnings))))]
#![deny(warnings)]
pub use self::Piece::*;
pub use self::Position::*;

View File

@ -287,7 +287,6 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
test(attr(allow(unused_variables), deny(warnings))))]
#![deny(warnings)]
#![feature(str_escape)]

View File

@ -19,7 +19,6 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
#![deny(warnings)]
#![panic_runtime]
#![allow(unused_features)]

View File

@ -28,7 +28,6 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
#![deny(warnings)]
#![feature(alloc)]
#![feature(core_intrinsics)]

View File

@ -24,7 +24,6 @@
//! See [the book](../book/first-edition/procedural-macros.html) for more.
#![stable(feature = "proc_macro_lib", since = "1.15.0")]
#![deny(warnings)]
#![deny(missing_docs)]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(warnings)]
#![feature(test)]
extern crate test;

View File

@ -39,7 +39,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(box_patterns)]
#![feature(box_syntax)]

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(warnings)]
#![feature(rustc_private)]
extern crate rustc;

View File

@ -43,7 +43,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![forbid(unsafe_code)]
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.

View File

@ -24,7 +24,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(box_syntax)]
#![feature(const_fn)]

View File

@ -11,7 +11,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![allow(non_camel_case_types)]

View File

@ -17,7 +17,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
extern crate rustc_apfloat;

View File

@ -19,7 +19,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(collections_range)]
#![feature(nonzero)]

View File

@ -17,7 +17,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(box_syntax)]
#![cfg_attr(unix, feature(libc))]

View File

@ -11,7 +11,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(custom_attribute)]
#![allow(unused_attributes)]

View File

@ -13,7 +13,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(fs_read_write)]
#![feature(specialization)]

View File

@ -22,7 +22,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![cfg_attr(test, feature(test))]
#![feature(box_patterns)]

View File

@ -16,7 +16,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(box_syntax)]
#![feature(concat_idents)]

View File

@ -11,7 +11,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(box_patterns)]
#![feature(fs_read_write)]

View File

@ -14,8 +14,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
*/
#![deny(warnings)]
#![feature(slice_patterns)]
#![feature(from_ref)]
#![feature(box_patterns)]

View File

@ -17,7 +17,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(rustc_diagnostic_macros)]

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(warnings)]
#![allow(bad_style)]
pub struct Intrinsic {

View File

@ -63,7 +63,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(rustc_diagnostic_macros)]
#![feature(staged_api)]

View File

@ -11,7 +11,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(rustc_diagnostic_macros)]

View File

@ -11,7 +11,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(rustc_diagnostic_macros)]

View File

@ -11,7 +11,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(custom_attribute)]
#![feature(macro_lifetime_matcher)]
#![allow(unused_attributes)]

View File

@ -11,8 +11,6 @@
//! New recursive solver modeled on Chalk's recursive solver. Most of
//! the guts are broken up into modules; see the comments in those modules.
#![deny(warnings)]
#![feature(crate_visibility_modifier)]
#[macro_use]

View File

@ -17,7 +17,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(box_patterns)]
#![feature(box_syntax)]

View File

@ -15,7 +15,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(box_patterns)]
#![feature(box_syntax)]

View File

@ -68,7 +68,6 @@ This API is completely unstable and subject to change.
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![allow(non_camel_case_types)]

View File

@ -12,7 +12,6 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/")]
#![deny(warnings)]
#![feature(ascii_ctype)]
#![feature(rustc_private)]

View File

@ -19,7 +19,6 @@ Core encoding and decoding interfaces.
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/",
test(attr(allow(unused_variables), deny(warnings))))]
#![deny(warnings)]
#![feature(box_syntax)]
#![feature(core_intrinsics)]

View File

@ -227,10 +227,6 @@
// Tell the compiler to link to either panic_abort or panic_unwind
#![needs_panic_runtime]
// Turn warnings into errors, but only after stage0, where it can be useful for
// code to emit warnings during language transitions
#![cfg_attr(not(stage0), deny(warnings))]
// std may use features in a platform-specific way
#![allow(unused_features)]

View File

@ -27,7 +27,6 @@
html_playground_url = "https://play.rust-lang.org/",
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
#![deny(warnings)]
#![deny(missing_debug_implementations)]
#![no_std]

View File

@ -18,7 +18,6 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
test(attr(deny(warnings))))]
#![deny(warnings)]
#![feature(unicode)]
#![feature(rustc_diagnostic_macros)]

View File

@ -13,7 +13,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(proc_macro_internals)]
#![feature(decl_macro)]

View File

@ -17,7 +17,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(const_fn)]
#![feature(custom_attribute)]

View File

@ -46,7 +46,6 @@
html_playground_url = "https://play.rust-lang.org/",
test(attr(deny(warnings))))]
#![deny(missing_docs)]
#![deny(warnings)]
#![cfg_attr(windows, feature(libc))]
// Handle rustfmt skips

View File

@ -31,7 +31,6 @@
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))]
#![deny(warnings)]
#![feature(asm)]
#![feature(fnbox)]
#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc))]

View File

@ -10,7 +10,6 @@
#![no_std]
#![unstable(feature = "panic_unwind", issue = "32837")]
#![deny(warnings)]
#![feature(cfg_target_vendor)]
#![feature(link_cfg)]

View File

@ -13,8 +13,6 @@
//! This library contains the tidy lints and exposes it
//! to be used by tools.
#![deny(warnings)]
extern crate serde;
extern crate serde_json;
#[macro_use]