Skip to content

Commit

Permalink
Auto merge of #64216 - Centril:rollup-5cc1w7o, r=Centril
Browse files Browse the repository at this point in the history
Rollup of 9 pull requests

Successful merges:

 - #64067 (Remove no-prefer-dynamic from valgrind tests)
 - #64078 (compiletest: disable -Aunused for run-pass tests)
 - #64096 (Fix regex replacement in theme detection)
 - #64098 (Ensure edition lints and internal lints are enabled with deny-warnings=false)
 - #64166 (Better way of conditioning the sanitizer builds)
 - #64189 (annotate-snippet emitter: Deal with multispans from macros, too)
 - #64202 (Fixed grammar/style in some error messages)
 - #64206 (annotate-snippet emitter: Update an issue number)
 - #64208 (it's more pythonic to use 'is not None' in python files)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Sep 6, 2019
2 parents 4894123 + 4ac73a1 commit 439ec56
Show file tree
Hide file tree
Showing 212 changed files with 746 additions and 689 deletions.
15 changes: 3 additions & 12 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,9 @@ fn main() {
cmd.arg(format!("-Cdebuginfo={}", debuginfo_level));
}

if env::var_os("RUSTC_DENY_WARNINGS").is_some() &&
env::var_os("RUSTC_EXTERNAL_TOOL").is_none() {
// When extending this list, add the new lints to the RUSTFLAGS of the
// build_bootstrap function of src/bootstrap/bootstrap.py as well as
// some code doesn't go through this `rustc` wrapper.
cmd.arg("-Dwarnings");
cmd.arg("-Drust_2018_idioms");
cmd.arg("-Dunused_lifetimes");
if use_internal_lints(crate_name) {
cmd.arg("-Zunstable-options");
cmd.arg("-Drustc::internal");
}
if use_internal_lints(crate_name) {
cmd.arg("-Zunstable-options");
cmd.arg("-Wrustc::internal");
}

if let Some(target) = target {
Expand Down
5 changes: 3 additions & 2 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,9 @@ def build_bootstrap(self):
target_linker = self.get_toml("linker", build_section)
if target_linker is not None:
env["RUSTFLAGS"] += "-C linker=" + target_linker + " "
env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes "
if self.get_toml("deny-warnings", "rust") != "false":
env["RUSTFLAGS"] += "-Dwarnings -Drust_2018_idioms -Dunused_lifetimes "
env["RUSTFLAGS"] += "-Dwarnings "

env["PATH"] = os.path.join(self.bin_root(), "bin") + \
os.pathsep + env["PATH"]
Expand Down Expand Up @@ -668,7 +669,7 @@ def check_submodule(self, module, slow_submodules):
def update_submodule(self, module, checked_out, recorded_submodules):
module_path = os.path.join(self.rust_root, module)

if checked_out != None:
if checked_out is not None:
default_encoding = sys.getdefaultencoding()
checked_out = checked_out.communicate()[0].decode(default_encoding).strip()
if recorded_submodules[module] == checked_out:
Expand Down
45 changes: 35 additions & 10 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,9 @@ impl<'a> Builder<'a> {
if cmd == "doc" || cmd == "rustdoc" {
let my_out = match mode {
// This is the intended out directory for compiler documentation.
Mode::Rustc | Mode::ToolRustc | Mode::Codegen => self.compiler_doc_out(target),
Mode::Rustc | Mode::ToolRustc { .. } | Mode::Codegen => {
self.compiler_doc_out(target)
}
_ => self.crate_doc_out(target),
};
let rustdoc = self.rustdoc(compiler);
Expand Down Expand Up @@ -797,8 +799,8 @@ impl<'a> Builder<'a> {
}

match mode {
Mode::Std | Mode::ToolBootstrap | Mode::ToolStd => {},
Mode::Rustc | Mode::Codegen | Mode::ToolRustc => {
Mode::Std | Mode::ToolBootstrap { .. } | Mode::ToolStd { .. } => {},
Mode::Rustc | Mode::Codegen | Mode::ToolRustc { .. } => {
// Build proc macros both for the host and the target
if target != compiler.host && cmd != "check" {
cargo.arg("-Zdual-proc-macros");
Expand Down Expand Up @@ -873,6 +875,28 @@ impl<'a> Builder<'a> {
extra_args.push_str("-Zforce-unstable-if-unmarked");
}

match mode {
Mode::ToolStd { in_tree: true } |
Mode::ToolRustc { in_tree: true } |
Mode::ToolBootstrap { in_tree: true } |
Mode::Std |
Mode::Rustc |
Mode::Codegen => {
// When extending this list, add the new lints to the RUSTFLAGS of the
// build_bootstrap function of src/bootstrap/bootstrap.py as well as
// some code doesn't go through this `rustc` wrapper.
extra_args.push_str(" -Wrust_2018_idioms");
extra_args.push_str(" -Wunused_lifetimes");
}
Mode::ToolStd { in_tree: false } |
Mode::ToolRustc { in_tree: false } |
Mode::ToolBootstrap { in_tree: false } => {}
}

if self.config.deny_warnings {
extra_args.push_str(" -Dwarnings");
}

if !extra_args.is_empty() {
cargo.env(
"RUSTFLAGS",
Expand All @@ -891,7 +915,11 @@ impl<'a> Builder<'a> {
// the stage0 build means it uses libraries build by the stage0
// compiler, but for tools we just use the precompiled libraries that
// we've downloaded
let use_snapshot = mode == Mode::ToolBootstrap;
let use_snapshot = if let Mode::ToolBootstrap { .. } = mode {
true
} else {
false
};
assert!(!use_snapshot || stage == 0 || self.local_rebuild);

let maybe_sysroot = self.sysroot(compiler);
Expand Down Expand Up @@ -944,8 +972,9 @@ impl<'a> Builder<'a> {
let debuginfo_level = match mode {
Mode::Rustc | Mode::Codegen => self.config.rust_debuginfo_level_rustc,
Mode::Std => self.config.rust_debuginfo_level_std,
Mode::ToolBootstrap | Mode::ToolStd |
Mode::ToolRustc => self.config.rust_debuginfo_level_tools,
Mode::ToolBootstrap { .. } | Mode::ToolStd { .. } | Mode::ToolRustc { .. } => {
self.config.rust_debuginfo_level_tools
}
};
cargo.env("RUSTC_DEBUGINFO_LEVEL", debuginfo_level.to_string());

Expand Down Expand Up @@ -1031,10 +1060,6 @@ impl<'a> Builder<'a> {

cargo.env("RUSTC_VERBOSE", self.verbosity.to_string());

if self.config.deny_warnings {
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.
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::compile::{run_cargo, std_cargo, rustc_cargo, rustc_cargo_env,
add_to_sysroot};
use crate::builder::{RunConfig, Builder, Kind, ShouldRun, Step};
use crate::tool::{prepare_tool_cargo, SourceType};
use crate::tool::prepare_tool_cargo;
use crate::{Compiler, Mode};
use crate::cache::{INTERNER, Interned};
use std::path::PathBuf;
Expand Down Expand Up @@ -187,11 +187,10 @@ impl Step for Rustdoc {

let mut cargo = prepare_tool_cargo(builder,
compiler,
Mode::ToolRustc,
Mode::ToolRustc { in_tree: true },
target,
cargo_subcommand(builder.kind),
"src/tools/rustdoc",
SourceType::InTree,
&[]);

println!("Checking rustdoc artifacts ({} -> {})", &compiler.host, target);
Expand Down Expand Up @@ -244,6 +243,7 @@ pub fn rustdoc_stamp(
compiler: Compiler,
target: Interned<String>,
) -> PathBuf {
builder.cargo_out(compiler, Mode::ToolRustc, target)
// doesn't really matter whether we're in-tree or not
builder.cargo_out(compiler, Mode::ToolRustc { in_tree: true }, target)
.join(".rustdoc-check.stamp")
}
1 change: 1 addition & 0 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ pub fn std_cargo(builder: &Builder<'_>,
emscripten: false,
});
cargo.env("LLVM_CONFIG", llvm_config);
cargo.env("RUSTC_BUILD_SANITIZERS", "1");
}

cargo.arg("--features").arg(features)
Expand Down
7 changes: 3 additions & 4 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use build_helper::{t, up_to_date};

use crate::util::symlink_dir;
use crate::builder::{Builder, Compiler, RunConfig, ShouldRun, Step};
use crate::tool::{self, prepare_tool_cargo, Tool, SourceType};
use crate::tool::{self, prepare_tool_cargo, Tool};
use crate::compile;
use crate::cache::{INTERNER, Interned};
use crate::config::Config;
Expand Down Expand Up @@ -633,7 +633,7 @@ impl Step for Rustdoc {
builder.ensure(tool::Rustdoc { compiler: compiler });

// Symlink compiler docs to the output directory of rustdoc documentation.
let out_dir = builder.stage_out(compiler, Mode::ToolRustc)
let out_dir = builder.stage_out(compiler, Mode::ToolRustc { in_tree: true })
.join(target)
.join("doc");
t!(fs::create_dir_all(&out_dir));
Expand All @@ -643,11 +643,10 @@ impl Step for Rustdoc {
let mut cargo = prepare_tool_cargo(
builder,
compiler,
Mode::ToolRustc,
Mode::ToolRustc { in_tree: true },
target,
"doc",
"src/tools/rustdoc",
SourceType::InTree,
&[]
);

Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct Flags {
// This overrides the deny-warnings configuation option,
// which passes -Dwarnings to the compiler invocations.
//
// true => deny, false => allow
// true => deny, false => warn
pub deny_warnings: Option<bool>,
}

Expand Down Expand Up @@ -556,10 +556,10 @@ fn split(s: &[String]) -> Vec<String> {
fn parse_deny_warnings(matches: &getopts::Matches) -> Option<bool> {
match matches.opt_str("warnings").as_ref().map(|v| v.as_str()) {
Some("deny") => Some(true),
Some("allow") => Some(false),
Some("warn") => Some(false),
Some(value) => {
eprintln!(
r#"invalid value for --warnings: {:?}, expected "allow" or "deny""#,
r#"invalid value for --warnings: {:?}, expected "warn" or "deny""#,
value,
);
process::exit(1);
Expand Down
12 changes: 6 additions & 6 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,19 +304,19 @@ pub enum Mode {
/// "other" here is for miscellaneous sets of tools that are built using the
/// bootstrap compiler in its entirety (target libraries and all).
/// Typically these tools compile with stable Rust.
ToolBootstrap,
ToolBootstrap { in_tree: bool },

/// Compile a tool which uses all libraries we compile (up to rustc).
/// Doesn't use the stage0 compiler libraries like "other", and includes
/// tools like rustdoc, cargo, rls, etc.
ToolStd,
ToolRustc,
ToolStd { in_tree: bool },
ToolRustc { in_tree: bool },
}

impl Mode {
pub fn is_tool(&self) -> bool {
match self {
Mode::ToolBootstrap | Mode::ToolRustc | Mode::ToolStd => true,
Mode::ToolBootstrap { .. } | Mode::ToolRustc { .. } | Mode::ToolStd { .. } => true,
_ => false
}
}
Expand Down Expand Up @@ -528,8 +528,8 @@ impl Build {
Mode::Std => "-std",
Mode::Rustc => "-rustc",
Mode::Codegen => "-codegen",
Mode::ToolBootstrap => "-bootstrap-tools",
Mode::ToolStd | Mode::ToolRustc => "-tools",
Mode::ToolBootstrap { .. } => "-bootstrap-tools",
Mode::ToolStd { .. } | Mode::ToolRustc { .. } => "-tools",
};
self.out.join(&*compiler.host)
.join(format!("stage{}{}", compiler.stage, suffix))
Expand Down
28 changes: 10 additions & 18 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::compile;
use crate::dist;
use crate::flags::Subcommand;
use crate::native;
use crate::tool::{self, Tool, SourceType};
use crate::tool::{self, Tool};
use crate::toolstate::ToolState;
use crate::util::{self, dylib_path, dylib_path_var};
use crate::Crate as CargoCrate;
Expand Down Expand Up @@ -213,11 +213,10 @@ impl Step for Cargo {
});
let mut cargo = tool::prepare_tool_cargo(builder,
compiler,
Mode::ToolRustc,
Mode::ToolRustc { in_tree: false },
self.host,
"test",
"src/tools/cargo",
SourceType::Submodule,
&[]);

if !builder.fail_fast {
Expand Down Expand Up @@ -279,11 +278,10 @@ impl Step for Rls {

let mut cargo = tool::prepare_tool_cargo(builder,
compiler,
Mode::ToolRustc,
Mode::ToolRustc { in_tree: false },
host,
"test",
"src/tools/rls",
SourceType::Submodule,
&[]);

builder.add_rustc_lib_path(compiler, &mut cargo);
Expand Down Expand Up @@ -335,11 +333,10 @@ impl Step for Rustfmt {

let mut cargo = tool::prepare_tool_cargo(builder,
compiler,
Mode::ToolRustc,
Mode::ToolRustc { in_tree: false },
host,
"test",
"src/tools/rustfmt",
SourceType::Submodule,
&[]);

let dir = testdir(builder, compiler.host);
Expand Down Expand Up @@ -392,11 +389,10 @@ impl Step for Miri {
let mut cargo = tool::prepare_tool_cargo(
builder,
compiler,
Mode::ToolRustc,
Mode::ToolRustc { in_tree: false },
host,
"run",
"src/tools/miri",
SourceType::Submodule,
&[],
);
cargo
Expand Down Expand Up @@ -451,11 +447,10 @@ impl Step for Miri {
let mut cargo = tool::prepare_tool_cargo(
builder,
compiler,
Mode::ToolRustc,
Mode::ToolRustc { in_tree: false },
host,
"test",
"src/tools/miri",
SourceType::Submodule,
&[],
);

Expand Down Expand Up @@ -504,11 +499,10 @@ impl Step for CompiletestTest {

let mut cargo = tool::prepare_tool_cargo(builder,
compiler,
Mode::ToolBootstrap,
Mode::ToolBootstrap { in_tree: true },
host,
"test",
"src/tools/compiletest",
SourceType::InTree,
&[]);

try_run(builder, &mut cargo);
Expand Down Expand Up @@ -551,19 +545,18 @@ impl Step for Clippy {
if let Some(clippy) = clippy {
let mut cargo = tool::prepare_tool_cargo(builder,
compiler,
Mode::ToolRustc,
Mode::ToolRustc { in_tree: false },
host,
"test",
"src/tools/clippy",
SourceType::Submodule,
&[]);

// clippy tests need to know about the stage sysroot
cargo.env("SYSROOT", builder.sysroot(compiler));
cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
let host_libs = builder
.stage_out(compiler, Mode::ToolRustc)
.stage_out(compiler, Mode::ToolRustc { in_tree: false })
.join(builder.cargo_dir());
cargo.env("HOST_LIBS", host_libs);
// clippy tests need to find the driver
Expand Down Expand Up @@ -1877,11 +1870,10 @@ impl Step for CrateRustdoc {

let mut cargo = tool::prepare_tool_cargo(builder,
compiler,
Mode::ToolRustc,
Mode::ToolRustc { in_tree: true },
target,
test_kind.subcommand(),
"src/tools/rustdoc",
SourceType::InTree,
&[]);
if test_kind.subcommand() == "test" && !builder.fail_fast {
cargo.arg("--no-fail-fast");
Expand Down
Loading

0 comments on commit 439ec56

Please sign in to comment.