From e098985939a1ac5baef4314aee44efc9dbf1b820 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Fri, 13 Jul 2018 14:12:58 +0900 Subject: Deny bare_trait_objects globally --- src/bootstrap/bin/rustc.rs | 3 ++- src/bootstrap/check.rs | 3 ++- src/bootstrap/doc.rs | 1 + src/bootstrap/test.rs | 9 ++++++--- src/bootstrap/tool.rs | 30 +++++++++++++++++++++++------- 5 files changed, 34 insertions(+), 12 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index f2b2f6f1eeb..d31e5382714 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -296,8 +296,9 @@ fn main() { cmd.arg("--color=always"); } - if env::var_os("RUSTC_DENY_WARNINGS").is_some() { + if env::var_os("RUSTC_DENY_WARNINGS").is_some() && env::var_os("RUSTC_EXT_TOOL").is_none() { cmd.arg("-Dwarnings"); + cmd.arg("-Dbare_trait_objects"); } if verbose > 1 { diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 39c5c832831..dd2a64402b4 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -222,7 +222,8 @@ impl Step for Rustdoc { Mode::ToolRustc, target, "check", - "src/tools/rustdoc"); + "src/tools/rustdoc", + false); let _folder = builder.fold_output(|| format!("stage{}-rustdoc", compiler.stage)); println!("Checking rustdoc artifacts ({} -> {})", &compiler.host, target); diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index f71cb119b77..913b8162a44 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -814,6 +814,7 @@ impl Step for Rustdoc { target, "doc", "src/tools/rustdoc", + false ); cargo.env("RUSTDOCFLAGS", "--document-private-items"); diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 639c96bc208..3bcebd08b1e 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -286,7 +286,8 @@ impl Step for Rls { Mode::ToolRustc, host, "test", - "src/tools/rls"); + "src/tools/rls", + true); // Don't build tests dynamically, just a pain to work with cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1"); @@ -341,7 +342,8 @@ impl Step for Rustfmt { Mode::ToolRustc, host, "test", - "src/tools/rustfmt"); + "src/tools/rustfmt", + true); // Don't build tests dynamically, just a pain to work with cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1"); @@ -1739,7 +1741,8 @@ impl Step for CrateRustdoc { Mode::ToolRustc, target, test_kind.subcommand(), - "src/tools/rustdoc"); + "src/tools/rustdoc", + false); if test_kind.subcommand() == "test" && !builder.fail_fast { cargo.arg("--no-fail-fast"); } diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 0969e5abe07..745733e4d4c 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -115,7 +115,15 @@ impl Step for ToolBuild { _ => panic!("unexpected Mode for tool build") } - let mut cargo = prepare_tool_cargo(builder, compiler, self.mode, target, "build", path); + let mut cargo = prepare_tool_cargo( + builder, + compiler, + self.mode, + target, + "build", + path, + is_ext_tool, + ); cargo.arg("--features").arg(self.extra_features.join(" ")); let _folder = builder.fold_output(|| format!("stage{}-{}", compiler.stage, tool)); @@ -238,6 +246,7 @@ pub fn prepare_tool_cargo( target: Interned, command: &'static str, path: &'static str, + is_ext_tool: bool, ) -> Command { let mut cargo = builder.cargo(compiler, mode, target, command); let dir = builder.src.join(path); @@ -247,6 +256,10 @@ pub fn prepare_tool_cargo( // stages and such and it's just easier if they're not dynamically linked. cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1"); + if is_ext_tool { + cargo.env("RUSTC_EXT_TOOL", "1"); + } + if let Some(dir) = builder.openssl_install_dir(target) { cargo.env("OPENSSL_STATIC", "1"); cargo.env("OPENSSL_DIR", dir); @@ -449,12 +462,15 @@ impl Step for Rustdoc { target: builder.config.build, }); - let mut cargo = prepare_tool_cargo(builder, - build_compiler, - Mode::ToolRustc, - target, - "build", - "src/tools/rustdoc"); + let mut cargo = prepare_tool_cargo( + builder, + build_compiler, + Mode::ToolRustc, + target, + "build", + "src/tools/rustdoc", + false, + ); // Most tools don't get debuginfo, but rustdoc should. cargo.env("RUSTC_DEBUGINFO", builder.config.rust_debuginfo.to_string()) -- cgit 1.4.1-3-g733a5