Skip to content

Commit

Permalink
Auto merge of #55382 - kennytm:rollup, r=kennytm
Browse files Browse the repository at this point in the history
Rollup of 21 pull requests

Successful merges:

 - #54816 (Don't try to promote already promoted out temporaries)
 - #54824 (Cleanup rustdoc tests with `@!has` and `@!matches`)
 - #54921 (Add line numbers option to rustdoc)
 - #55167 (Add a "cheap" mode for `compute_missing_ctors`.)
 - #55258 (Fix Rustdoc ICE when checking blanket impls)
 - #55264 (Compile the libstd we distribute with -Ccodegen-unit=1)
 - #55271 (Unimplement ExactSizeIterator for MIR traversing iterators)
 - #55292 (Macro diagnostics tweaks)
 - #55298 (Point at macro definition when no rules expect token)
 - #55301 (List allowed tokens after macro fragments)
 - #55302 (Extend the impl_stable_hash_for! macro for miri.)
 - #55325 (Fix link to macros chapter)
 - #55343 (rustbuild: fix remap-debuginfo when building a release)
 - #55346 (Shrink `Statement`.)
 - #55358 (Remove redundant clone (2))
 - #55370 (Update mailmap for estebank)
 - #55375 (Typo fixes in configure_cmake comments)
 - #55378 (rustbuild: use configured linker to build boostrap)
 - #55379 (validity: assert that unions are non-empty)
 - #55383 (Use `SmallVec` for the queue in `coerce_unsized`.)
 - #55391 (bootstrap: clean up a few clippy findings)
  • Loading branch information
bors committed Oct 26, 2018
2 parents bf962e2 + eb29530 commit 3e6f30e
Show file tree
Hide file tree
Showing 113 changed files with 1,170 additions and 497 deletions.
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Eric Holk <[email protected]> <[email protected]>
Eric Holmes <[email protected]>
Eric Reed <[email protected]> <[email protected]>
Erick Tryzelaar <[email protected]> <[email protected]>
Esteban Küber <[email protected]> <[email protected]> <[email protected]> <[email protected]>
Evgeny Sologubov
Falco Hirschenberger <[email protected]> <[email protected]>
Felix S. Klock II <[email protected]> Felix S Klock II <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Misc
[cargo/5877]: https://github.com/rust-lang/cargo/pull/5877/
[cargo/5878]: https://github.com/rust-lang/cargo/pull/5878/
[cargo/5995]: https://github.com/rust-lang/cargo/pull/5995/
[proc-macros]: https://doc.rust-lang.org/book/2018-edition/ch19-06-macros.html
[proc-macros]: https://doc.rust-lang.org/nightly/book/2018-edition/ch19-06-macros.html

[`Ipv4Addr::BROADCAST`]: https://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#associatedconstant.BROADCAST
[`Ipv4Addr::LOCALHOST`]: https://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#associatedconstant.LOCALHOST
Expand Down
4 changes: 4 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@
# compiler.
#codegen-units = 1

# Sets the number of codegen units to build the standard library with,
# regardless of what the codegen-unit setting for the rest of the compiler is.
#codegen-units-std = 1

# Whether or not debug assertions are enabled for the compiler and standard
# library. Also enables compilation of debug! and trace! logging macros.
#debug-assertions = false
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@ def build_bootstrap(self):
target_features += ["-crt-static"]
if target_features:
env["RUSTFLAGS"] += "-C target-feature=" + (",".join(target_features)) + " "
target_linker = self.get_toml("linker", build_section)
if target_linker is not None:
env["RUSTFLAGS"] += "-C linker=" + target_linker + " "

env["PATH"] = os.path.join(self.bin_root(), "bin") + \
os.pathsep + env["PATH"]
Expand Down
13 changes: 9 additions & 4 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1119,10 +1119,15 @@ impl<'a> Builder<'a> {
cargo.arg("-v");
}

// This must be kept before the thinlto check, as we set codegen units
// to 1 forcibly there.
if let Some(n) = self.config.rust_codegen_units {
cargo.env("RUSTC_CODEGEN_UNITS", n.to_string());
match (mode, self.config.rust_codegen_units_std, self.config.rust_codegen_units) {
(Mode::Std, Some(n), _) |
(Mode::Test, Some(n), _) |
(_, _, Some(n)) => {
cargo.env("RUSTC_CODEGEN_UNITS", n.to_string());
}
_ => {
// Don't set anything
}
}

if self.config.rust_optimize {
Expand Down
10 changes: 5 additions & 5 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Step for Std {
if builder.config.keep_stage.contains(&compiler.stage) {
builder.info("Warning: Using a potentially old libstd. This may not behave well.");
builder.ensure(StdLink {
compiler: compiler,
compiler,
target_compiler: compiler,
target,
});
Expand Down Expand Up @@ -358,7 +358,7 @@ impl Step for Test {
if builder.config.keep_stage.contains(&compiler.stage) {
builder.info("Warning: Using a potentially old libtest. This may not behave well.");
builder.ensure(TestLink {
compiler: compiler,
compiler,
target_compiler: compiler,
target,
});
Expand Down Expand Up @@ -480,7 +480,7 @@ impl Step for Rustc {
if builder.config.keep_stage.contains(&compiler.stage) {
builder.info("Warning: Using a potentially old librustc. This may not behave well.");
builder.ensure(RustcLink {
compiler: compiler,
compiler,
target_compiler: compiler,
target,
});
Expand Down Expand Up @@ -816,8 +816,8 @@ fn copy_codegen_backends_to_sysroot(builder: &Builder,
let filename = file.file_name().unwrap().to_str().unwrap();
// change `librustc_codegen_llvm-xxxxxx.so` to `librustc_codegen_llvm-llvm.so`
let target_filename = {
let dash = filename.find("-").unwrap();
let dot = filename.find(".").unwrap();
let dash = filename.find('-').unwrap();
let dot = filename.find('.').unwrap();
format!("{}-{}{}",
&filename[..dash],
backend,
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ pub struct Config {
// rust codegen options
pub rust_optimize: bool,
pub rust_codegen_units: Option<u32>,
pub rust_codegen_units_std: Option<u32>,
pub rust_debug_assertions: bool,
pub rust_debuginfo: bool,
pub rust_debuginfo_lines: bool,
Expand Down Expand Up @@ -294,6 +295,7 @@ impl Default for StringOrBool {
struct Rust {
optimize: Option<bool>,
codegen_units: Option<u32>,
codegen_units_std: Option<u32>,
debug_assertions: Option<bool>,
debuginfo: Option<bool>,
debuginfo_lines: Option<bool>,
Expand Down Expand Up @@ -580,6 +582,8 @@ impl Config {
Some(n) => config.rust_codegen_units = Some(n),
None => {}
}

config.rust_codegen_units_std = rust.codegen_units_std;
}

if let Some(ref t) = toml.target {
Expand Down
13 changes: 12 additions & 1 deletion src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,13 @@ def set(key, value):
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", target)


def is_number(value):
try:
float(value)
return True
except:
return False

# Here we walk through the constructed configuration we have from the parsed
# command line arguments. We then apply each piece of configuration by
# basically just doing a `sed` to change the various configuration line to what
Expand All @@ -406,7 +413,11 @@ def to_toml(value):
elif isinstance(value, list):
return '[' + ', '.join(map(to_toml, value)) + ']'
elif isinstance(value, str):
return "'" + value + "'"
# Don't put quotes around numeric values
if is_number(value):
return value
else:
return "'" + value + "'"
else:
raise RuntimeError('no toml')

Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1447,8 +1447,8 @@ impl Step for Extended {
tarballs.extend(rls_installer.clone());
tarballs.extend(clippy_installer.clone());
tarballs.extend(rustfmt_installer.clone());
tarballs.extend(llvm_tools_installer.clone());
tarballs.extend(lldb_installer.clone());
tarballs.extend(llvm_tools_installer);
tarballs.extend(lldb_installer);
tarballs.push(analysis_installer);
tarballs.push(std_installer);
if builder.config.docs {
Expand Down
19 changes: 9 additions & 10 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ impl Default for Subcommand {
impl Flags {
pub fn parse(args: &[String]) -> Flags {
let mut extra_help = String::new();
let mut subcommand_help = format!(
"\
let mut subcommand_help = String::from("\
Usage: x.py <subcommand> [options] [<paths>...]
Subcommands:
Expand Down Expand Up @@ -365,8 +364,8 @@ Arguments:
}

let cmd = match subcommand.as_str() {
"build" => Subcommand::Build { paths: paths },
"check" => Subcommand::Check { paths: paths },
"build" => Subcommand::Build { paths },
"check" => Subcommand::Check { paths },
"test" => Subcommand::Test {
paths,
bless: matches.opt_present("bless"),
Expand All @@ -386,9 +385,9 @@ Arguments:
paths,
test_args: matches.opt_strs("test-args"),
},
"doc" => Subcommand::Doc { paths: paths },
"doc" => Subcommand::Doc { paths },
"clean" => {
if paths.len() > 0 {
if !paths.is_empty() {
println!("\nclean does not take a path argument\n");
usage(1, &opts, &subcommand_help, &extra_help);
}
Expand All @@ -413,19 +412,19 @@ Arguments:
keep_stage: matches.opt_strs("keep-stage")
.into_iter().map(|j| j.parse().unwrap())
.collect(),
host: split(matches.opt_strs("host"))
host: split(&matches.opt_strs("host"))
.into_iter()
.map(|x| INTERNER.intern_string(x))
.collect::<Vec<_>>(),
target: split(matches.opt_strs("target"))
target: split(&matches.opt_strs("target"))
.into_iter()
.map(|x| INTERNER.intern_string(x))
.collect::<Vec<_>>(),
config: cfg_file,
jobs: matches.opt_str("jobs").map(|j| j.parse().unwrap()),
cmd,
incremental: matches.opt_present("incremental"),
exclude: split(matches.opt_strs("exclude"))
exclude: split(&matches.opt_strs("exclude"))
.into_iter()
.map(|p| p.into())
.collect::<Vec<_>>(),
Expand Down Expand Up @@ -488,7 +487,7 @@ impl Subcommand {
}
}

fn split(s: Vec<String>) -> Vec<String> {
fn split(s: &[String]) -> Vec<String> {
s.iter()
.flat_map(|s| s.split(','))
.map(|s| s.to_string())
Expand Down
10 changes: 5 additions & 5 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,10 +765,10 @@ impl Build {

let path = match which {
GitRepo::Rustc => {
let sha = self.rust_info.sha().expect("failed to find sha");
let sha = self.rust_sha().unwrap_or(channel::CFG_RELEASE_NUM);
format!("/rustc/{}", sha)
}
GitRepo::Llvm => format!("/rustc/llvm"),
GitRepo::Llvm => String::from("/rustc/llvm"),
};
Some(format!("{}={}", self.src.display(), path))
}
Expand All @@ -783,7 +783,7 @@ impl Build {
fn cflags(&self, target: Interned<String>, which: GitRepo) -> Vec<String> {
// Filter out -O and /O (the optimization flags) that we picked up from
// cc-rs because the build scripts will determine that for themselves.
let mut base = self.cc[&target].args().iter()
let mut base: Vec<String> = self.cc[&target].args().iter()
.map(|s| s.to_string_lossy().into_owned())
.filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
.collect::<Vec<_>>();
Expand All @@ -806,10 +806,10 @@ impl Build {
if let Some(map) = self.debuginfo_map(which) {
let cc = self.cc(target);
if cc.ends_with("clang") || cc.ends_with("gcc") {
base.push(format!("-fdebug-prefix-map={}", map).into());
base.push(format!("-fdebug-prefix-map={}", map));
} else if cc.ends_with("clang-cl.exe") {
base.push("-Xclang".into());
base.push(format!("-fdebug-prefix-map={}", map).into());
base.push(format!("-fdebug-prefix-map={}", map));
}
}
base
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,15 @@ fn configure_cmake(builder: &Builder,
// definitely causes problems since all the env vars are pointing to
// 32-bit libraries.
//
// To hack aroudn this... again... we pass an argument that's
// To hack around this... again... we pass an argument that's
// unconditionally passed in the sccache shim. This'll get CMake to
// correctly diagnose it's doing a 32-bit compilation and LLVM will
// internally configure itself appropriately.
if builder.config.llvm_clang_cl.is_some() && target.contains("i686") {
cfg.env("SCCACHE_EXTRA_ARGS", "-m32");
}

// If ccache is configured we inform the build a little differently hwo
// If ccache is configured we inform the build a little differently how
// to invoke ccache while also invoking our compilers.
} else if let Some(ref ccache) = builder.config.ccache {
cfg.define("CMAKE_C_COMPILER", ccache)
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn check(build: &mut Build) {
// one is present as part of the PATH then that can lead to the system
// being unable to identify the files properly. See
// https://github.com/rust-lang/rust/issues/34959 for more details.
if cfg!(windows) && path.to_string_lossy().contains("\"") {
if cfg!(windows) && path.to_string_lossy().contains('\"') {
panic!("PATH contains invalid character '\"'");
}

Expand Down
22 changes: 11 additions & 11 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ impl Step for RustdocTheme {
fn make_run(run: RunConfig) {
let compiler = run.builder.compiler(run.builder.top_stage, run.host);

run.builder.ensure(RustdocTheme { compiler: compiler });
run.builder.ensure(RustdocTheme { compiler });
}

fn run(self, builder: &Builder) {
Expand Down Expand Up @@ -584,9 +584,9 @@ impl Step for RustdocJS {
});
builder.run(&mut command);
} else {
builder.info(&format!(
builder.info(
"No nodejs found, skipping \"src/test/rustdoc-js\" tests"
));
);
}
}
}
Expand Down Expand Up @@ -653,7 +653,7 @@ impl Step for Tidy {
}

let _folder = builder.fold_output(|| "tidy");
builder.info(&format!("tidy check"));
builder.info("tidy check");
try_run(builder, &mut cmd);
}

Expand Down Expand Up @@ -1052,7 +1052,7 @@ impl Step for Compiletest {
let hostflags = flags.clone();
cmd.arg("--host-rustcflags").arg(hostflags.join(" "));

let mut targetflags = flags.clone();
let mut targetflags = flags;
targetflags.push(format!(
"-Lnative={}",
builder.test_helpers_out(target).display()
Expand Down Expand Up @@ -1168,9 +1168,9 @@ impl Step for Compiletest {
}
}
if suite == "run-make-fulldeps" && !builder.config.llvm_enabled {
builder.info(&format!(
builder.info(
"Ignoring run-make test suite as they generally don't work without LLVM"
));
);
return;
}

Expand Down Expand Up @@ -1692,10 +1692,10 @@ impl Step for Crate {
// The javascript shim implements the syscall interface so that test
// output can be correctly reported.
if !builder.config.wasm_syscall {
builder.info(&format!(
builder.info(
"Libstd was built without `wasm_syscall` feature enabled: \
test output may not be visible."
));
);
}

// On the wasm32-unknown-unknown target we're using LTO which is
Expand Down Expand Up @@ -1891,7 +1891,7 @@ impl Step for Distcheck {

/// Run "distcheck", a 'make check' from a tarball
fn run(self, builder: &Builder) {
builder.info(&format!("Distcheck"));
builder.info("Distcheck");
let dir = builder.out.join("tmp").join("distcheck");
let _ = fs::remove_dir_all(&dir);
t!(fs::create_dir_all(&dir));
Expand Down Expand Up @@ -1919,7 +1919,7 @@ impl Step for Distcheck {
);

// Now make sure that rust-src has all of libstd's dependencies
builder.info(&format!("Distcheck rust-src"));
builder.info("Distcheck rust-src");
let dir = builder.out.join("tmp").join("distcheck-src");
let _ = fs::remove_dir_all(&dir);
t!(fs::create_dir_all(&dir));
Expand Down
Loading

0 comments on commit 3e6f30e

Please sign in to comment.