Skip to content

Commit 22699d3

Browse files
committed
Move handling of internal lints to build.rs
1 parent f8b19f2 commit 22699d3

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

src/bootstrap/bin/rustc.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,6 @@ fn main() {
101101
cmd.arg(format!("-Cdebuginfo={}", debuginfo_level));
102102
}
103103

104-
if env::var_os("RUSTC_EXTERNAL_TOOL").is_none() {
105-
if use_internal_lints(crate_name) {
106-
cmd.arg("-Zunstable-options");
107-
cmd.arg("-Wrustc::internal");
108-
}
109-
}
110-
111104
if let Some(target) = target {
112105
// The stage0 compiler has a special sysroot distinct from what we
113106
// actually downloaded, so we just always pass the `--sysroot` option,
@@ -261,14 +254,6 @@ fn main() {
261254
std::process::exit(code);
262255
}
263256

264-
// Rustc crates for which internal lints are in effect.
265-
fn use_internal_lints(crate_name: Option<&str>) -> bool {
266-
crate_name.map_or(false, |crate_name| {
267-
crate_name.starts_with("rustc") || crate_name.starts_with("syntax") ||
268-
["arena", "fmt_macros"].contains(&crate_name)
269-
})
270-
}
271-
272257
#[cfg(unix)]
273258
fn exec_cmd(cmd: &mut Command) -> io::Result<i32> {
274259
use std::os::unix::process::CommandExt;

src/bootstrap/builder.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,14 @@ impl<'a> Builder<'a> {
10671067
}
10681068
}
10691069

1070+
match mode {
1071+
Mode::Rustc | Mode::Codegen => {
1072+
rustflags.arg("-Zunstable-options");
1073+
rustflags.arg("-Wrustc::internal");
1074+
}
1075+
_ => {}
1076+
}
1077+
10701078
// Throughout the build Cargo can execute a number of build scripts
10711079
// compiling C/C++ code and we need to pass compilers, archivers, flags, etc
10721080
// obtained previously to those build scripts.

src/libserialize/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Core encoding and decoding interfaces.
1515
#![feature(nll)]
1616
#![feature(associated_type_bounds)]
1717
#![cfg_attr(test, feature(test))]
18+
#![allow(rustc::internal)]
1819

1920
pub use self::serialize::{Decoder, Encoder, Decodable, Encodable};
2021

0 commit comments

Comments
 (0)