From 22699d31394489fd42ee53ba4fcf2543ca9a1ec6 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 9 Sep 2019 09:31:42 -0700 Subject: [PATCH] Move handling of internal lints to `build.rs` --- src/bootstrap/bin/rustc.rs | 15 --------------- src/bootstrap/builder.rs | 8 ++++++++ src/libserialize/lib.rs | 1 + 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index eb5b03f181d2..62ab6ef7ebe3 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -101,13 +101,6 @@ fn main() { cmd.arg(format!("-Cdebuginfo={}", debuginfo_level)); } - if env::var_os("RUSTC_EXTERNAL_TOOL").is_none() { - if use_internal_lints(crate_name) { - cmd.arg("-Zunstable-options"); - cmd.arg("-Wrustc::internal"); - } - } - if let Some(target) = target { // The stage0 compiler has a special sysroot distinct from what we // actually downloaded, so we just always pass the `--sysroot` option, @@ -261,14 +254,6 @@ fn main() { std::process::exit(code); } -// Rustc crates for which internal lints are in effect. -fn use_internal_lints(crate_name: Option<&str>) -> bool { - crate_name.map_or(false, |crate_name| { - crate_name.starts_with("rustc") || crate_name.starts_with("syntax") || - ["arena", "fmt_macros"].contains(&crate_name) - }) -} - #[cfg(unix)] fn exec_cmd(cmd: &mut Command) -> io::Result { use std::os::unix::process::CommandExt; diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index e415389d307e..62b77af13c1e 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1067,6 +1067,14 @@ impl<'a> Builder<'a> { } } + match mode { + Mode::Rustc | Mode::Codegen => { + rustflags.arg("-Zunstable-options"); + rustflags.arg("-Wrustc::internal"); + } + _ => {} + } + // 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. diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index 67a48ca4af90..e45d56c320cd 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -15,6 +15,7 @@ Core encoding and decoding interfaces. #![feature(nll)] #![feature(associated_type_bounds)] #![cfg_attr(test, feature(test))] +#![allow(rustc::internal)] pub use self::serialize::{Decoder, Encoder, Decodable, Encodable};