Skip to content

Commit 3e6f30e

Browse files
committed
Auto merge of #55382 - kennytm:rollup, r=kennytm
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)
2 parents bf962e2 + eb29530 commit 3e6f30e

File tree

113 files changed

+1170
-497
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+1170
-497
lines changed

.mailmap

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Eric Holk <[email protected]> <[email protected]>
7878
Eric Holmes <[email protected]>
7979
8080
81+
8182
Evgeny Sologubov
8283
Falco Hirschenberger <[email protected]> <[email protected]>
8384
Felix S. Klock II <[email protected]> Felix S Klock II <[email protected]>

RELEASES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Misc
9898
[cargo/5877]: https://github.com/rust-lang/cargo/pull/5877/
9999
[cargo/5878]: https://github.com/rust-lang/cargo/pull/5878/
100100
[cargo/5995]: https://github.com/rust-lang/cargo/pull/5995/
101-
[proc-macros]: https://doc.rust-lang.org/book/2018-edition/ch19-06-macros.html
101+
[proc-macros]: https://doc.rust-lang.org/nightly/book/2018-edition/ch19-06-macros.html
102102

103103
[`Ipv4Addr::BROADCAST`]: https://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#associatedconstant.BROADCAST
104104
[`Ipv4Addr::LOCALHOST`]: https://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#associatedconstant.LOCALHOST

config.toml.example

+4
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@
277277
# compiler.
278278
#codegen-units = 1
279279

280+
# Sets the number of codegen units to build the standard library with,
281+
# regardless of what the codegen-unit setting for the rest of the compiler is.
282+
#codegen-units-std = 1
283+
280284
# Whether or not debug assertions are enabled for the compiler and standard
281285
# library. Also enables compilation of debug! and trace! logging macros.
282286
#debug-assertions = false

src/bootstrap/bootstrap.py

+3
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,9 @@ def build_bootstrap(self):
632632
target_features += ["-crt-static"]
633633
if target_features:
634634
env["RUSTFLAGS"] += "-C target-feature=" + (",".join(target_features)) + " "
635+
target_linker = self.get_toml("linker", build_section)
636+
if target_linker is not None:
637+
env["RUSTFLAGS"] += "-C linker=" + target_linker + " "
635638

636639
env["PATH"] = os.path.join(self.bin_root(), "bin") + \
637640
os.pathsep + env["PATH"]

src/bootstrap/builder.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -1119,10 +1119,15 @@ impl<'a> Builder<'a> {
11191119
cargo.arg("-v");
11201120
}
11211121

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

11281133
if self.config.rust_optimize {

src/bootstrap/compile.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl Step for Std {
6969
if builder.config.keep_stage.contains(&compiler.stage) {
7070
builder.info("Warning: Using a potentially old libstd. This may not behave well.");
7171
builder.ensure(StdLink {
72-
compiler: compiler,
72+
compiler,
7373
target_compiler: compiler,
7474
target,
7575
});
@@ -358,7 +358,7 @@ impl Step for Test {
358358
if builder.config.keep_stage.contains(&compiler.stage) {
359359
builder.info("Warning: Using a potentially old libtest. This may not behave well.");
360360
builder.ensure(TestLink {
361-
compiler: compiler,
361+
compiler,
362362
target_compiler: compiler,
363363
target,
364364
});
@@ -480,7 +480,7 @@ impl Step for Rustc {
480480
if builder.config.keep_stage.contains(&compiler.stage) {
481481
builder.info("Warning: Using a potentially old librustc. This may not behave well.");
482482
builder.ensure(RustcLink {
483-
compiler: compiler,
483+
compiler,
484484
target_compiler: compiler,
485485
target,
486486
});
@@ -816,8 +816,8 @@ fn copy_codegen_backends_to_sysroot(builder: &Builder,
816816
let filename = file.file_name().unwrap().to_str().unwrap();
817817
// change `librustc_codegen_llvm-xxxxxx.so` to `librustc_codegen_llvm-llvm.so`
818818
let target_filename = {
819-
let dash = filename.find("-").unwrap();
820-
let dot = filename.find(".").unwrap();
819+
let dash = filename.find('-').unwrap();
820+
let dot = filename.find('.').unwrap();
821821
format!("{}-{}{}",
822822
&filename[..dash],
823823
backend,

src/bootstrap/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ pub struct Config {
9595
// rust codegen options
9696
pub rust_optimize: bool,
9797
pub rust_codegen_units: Option<u32>,
98+
pub rust_codegen_units_std: Option<u32>,
9899
pub rust_debug_assertions: bool,
99100
pub rust_debuginfo: bool,
100101
pub rust_debuginfo_lines: bool,
@@ -294,6 +295,7 @@ impl Default for StringOrBool {
294295
struct Rust {
295296
optimize: Option<bool>,
296297
codegen_units: Option<u32>,
298+
codegen_units_std: Option<u32>,
297299
debug_assertions: Option<bool>,
298300
debuginfo: Option<bool>,
299301
debuginfo_lines: Option<bool>,
@@ -580,6 +582,8 @@ impl Config {
580582
Some(n) => config.rust_codegen_units = Some(n),
581583
None => {}
582584
}
585+
586+
config.rust_codegen_units_std = rust.codegen_units_std;
583587
}
584588

585589
if let Some(ref t) = toml.target {

src/bootstrap/configure.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,13 @@ def set(key, value):
393393
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", target)
394394

395395

396+
def is_number(value):
397+
try:
398+
float(value)
399+
return True
400+
except:
401+
return False
402+
396403
# Here we walk through the constructed configuration we have from the parsed
397404
# command line arguments. We then apply each piece of configuration by
398405
# basically just doing a `sed` to change the various configuration line to what
@@ -406,7 +413,11 @@ def to_toml(value):
406413
elif isinstance(value, list):
407414
return '[' + ', '.join(map(to_toml, value)) + ']'
408415
elif isinstance(value, str):
409-
return "'" + value + "'"
416+
# Don't put quotes around numeric values
417+
if is_number(value):
418+
return value
419+
else:
420+
return "'" + value + "'"
410421
else:
411422
raise RuntimeError('no toml')
412423

src/bootstrap/dist.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1447,8 +1447,8 @@ impl Step for Extended {
14471447
tarballs.extend(rls_installer.clone());
14481448
tarballs.extend(clippy_installer.clone());
14491449
tarballs.extend(rustfmt_installer.clone());
1450-
tarballs.extend(llvm_tools_installer.clone());
1451-
tarballs.extend(lldb_installer.clone());
1450+
tarballs.extend(llvm_tools_installer);
1451+
tarballs.extend(lldb_installer);
14521452
tarballs.push(analysis_installer);
14531453
tarballs.push(std_installer);
14541454
if builder.config.docs {

src/bootstrap/flags.rs

+9-10
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ impl Default for Subcommand {
9393
impl Flags {
9494
pub fn parse(args: &[String]) -> Flags {
9595
let mut extra_help = String::new();
96-
let mut subcommand_help = format!(
97-
"\
96+
let mut subcommand_help = String::from("\
9897
Usage: x.py <subcommand> [options] [<paths>...]
9998
10099
Subcommands:
@@ -365,8 +364,8 @@ Arguments:
365364
}
366365

367366
let cmd = match subcommand.as_str() {
368-
"build" => Subcommand::Build { paths: paths },
369-
"check" => Subcommand::Check { paths: paths },
367+
"build" => Subcommand::Build { paths },
368+
"check" => Subcommand::Check { paths },
370369
"test" => Subcommand::Test {
371370
paths,
372371
bless: matches.opt_present("bless"),
@@ -386,9 +385,9 @@ Arguments:
386385
paths,
387386
test_args: matches.opt_strs("test-args"),
388387
},
389-
"doc" => Subcommand::Doc { paths: paths },
388+
"doc" => Subcommand::Doc { paths },
390389
"clean" => {
391-
if paths.len() > 0 {
390+
if !paths.is_empty() {
392391
println!("\nclean does not take a path argument\n");
393392
usage(1, &opts, &subcommand_help, &extra_help);
394393
}
@@ -413,19 +412,19 @@ Arguments:
413412
keep_stage: matches.opt_strs("keep-stage")
414413
.into_iter().map(|j| j.parse().unwrap())
415414
.collect(),
416-
host: split(matches.opt_strs("host"))
415+
host: split(&matches.opt_strs("host"))
417416
.into_iter()
418417
.map(|x| INTERNER.intern_string(x))
419418
.collect::<Vec<_>>(),
420-
target: split(matches.opt_strs("target"))
419+
target: split(&matches.opt_strs("target"))
421420
.into_iter()
422421
.map(|x| INTERNER.intern_string(x))
423422
.collect::<Vec<_>>(),
424423
config: cfg_file,
425424
jobs: matches.opt_str("jobs").map(|j| j.parse().unwrap()),
426425
cmd,
427426
incremental: matches.opt_present("incremental"),
428-
exclude: split(matches.opt_strs("exclude"))
427+
exclude: split(&matches.opt_strs("exclude"))
429428
.into_iter()
430429
.map(|p| p.into())
431430
.collect::<Vec<_>>(),
@@ -488,7 +487,7 @@ impl Subcommand {
488487
}
489488
}
490489

491-
fn split(s: Vec<String>) -> Vec<String> {
490+
fn split(s: &[String]) -> Vec<String> {
492491
s.iter()
493492
.flat_map(|s| s.split(','))
494493
.map(|s| s.to_string())

src/bootstrap/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -765,10 +765,10 @@ impl Build {
765765

766766
let path = match which {
767767
GitRepo::Rustc => {
768-
let sha = self.rust_info.sha().expect("failed to find sha");
768+
let sha = self.rust_sha().unwrap_or(channel::CFG_RELEASE_NUM);
769769
format!("/rustc/{}", sha)
770770
}
771-
GitRepo::Llvm => format!("/rustc/llvm"),
771+
GitRepo::Llvm => String::from("/rustc/llvm"),
772772
};
773773
Some(format!("{}={}", self.src.display(), path))
774774
}
@@ -783,7 +783,7 @@ impl Build {
783783
fn cflags(&self, target: Interned<String>, which: GitRepo) -> Vec<String> {
784784
// Filter out -O and /O (the optimization flags) that we picked up from
785785
// cc-rs because the build scripts will determine that for themselves.
786-
let mut base = self.cc[&target].args().iter()
786+
let mut base: Vec<String> = self.cc[&target].args().iter()
787787
.map(|s| s.to_string_lossy().into_owned())
788788
.filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
789789
.collect::<Vec<_>>();
@@ -806,10 +806,10 @@ impl Build {
806806
if let Some(map) = self.debuginfo_map(which) {
807807
let cc = self.cc(target);
808808
if cc.ends_with("clang") || cc.ends_with("gcc") {
809-
base.push(format!("-fdebug-prefix-map={}", map).into());
809+
base.push(format!("-fdebug-prefix-map={}", map));
810810
} else if cc.ends_with("clang-cl.exe") {
811811
base.push("-Xclang".into());
812-
base.push(format!("-fdebug-prefix-map={}", map).into());
812+
base.push(format!("-fdebug-prefix-map={}", map));
813813
}
814814
}
815815
base

src/bootstrap/native.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -353,15 +353,15 @@ fn configure_cmake(builder: &Builder,
353353
// definitely causes problems since all the env vars are pointing to
354354
// 32-bit libraries.
355355
//
356-
// To hack aroudn this... again... we pass an argument that's
356+
// To hack around this... again... we pass an argument that's
357357
// unconditionally passed in the sccache shim. This'll get CMake to
358358
// correctly diagnose it's doing a 32-bit compilation and LLVM will
359359
// internally configure itself appropriately.
360360
if builder.config.llvm_clang_cl.is_some() && target.contains("i686") {
361361
cfg.env("SCCACHE_EXTRA_ARGS", "-m32");
362362
}
363363

364-
// If ccache is configured we inform the build a little differently hwo
364+
// If ccache is configured we inform the build a little differently how
365365
// to invoke ccache while also invoking our compilers.
366366
} else if let Some(ref ccache) = builder.config.ccache {
367367
cfg.define("CMAKE_C_COMPILER", ccache)

src/bootstrap/sanity.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn check(build: &mut Build) {
7474
// one is present as part of the PATH then that can lead to the system
7575
// being unable to identify the files properly. See
7676
// https://github.com/rust-lang/rust/issues/34959 for more details.
77-
if cfg!(windows) && path.to_string_lossy().contains("\"") {
77+
if cfg!(windows) && path.to_string_lossy().contains('\"') {
7878
panic!("PATH contains invalid character '\"'");
7979
}
8080

src/bootstrap/test.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ impl Step for RustdocTheme {
521521
fn make_run(run: RunConfig) {
522522
let compiler = run.builder.compiler(run.builder.top_stage, run.host);
523523

524-
run.builder.ensure(RustdocTheme { compiler: compiler });
524+
run.builder.ensure(RustdocTheme { compiler });
525525
}
526526

527527
fn run(self, builder: &Builder) {
@@ -584,9 +584,9 @@ impl Step for RustdocJS {
584584
});
585585
builder.run(&mut command);
586586
} else {
587-
builder.info(&format!(
587+
builder.info(
588588
"No nodejs found, skipping \"src/test/rustdoc-js\" tests"
589-
));
589+
);
590590
}
591591
}
592592
}
@@ -653,7 +653,7 @@ impl Step for Tidy {
653653
}
654654

655655
let _folder = builder.fold_output(|| "tidy");
656-
builder.info(&format!("tidy check"));
656+
builder.info("tidy check");
657657
try_run(builder, &mut cmd);
658658
}
659659

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

1055-
let mut targetflags = flags.clone();
1055+
let mut targetflags = flags;
10561056
targetflags.push(format!(
10571057
"-Lnative={}",
10581058
builder.test_helpers_out(target).display()
@@ -1168,9 +1168,9 @@ impl Step for Compiletest {
11681168
}
11691169
}
11701170
if suite == "run-make-fulldeps" && !builder.config.llvm_enabled {
1171-
builder.info(&format!(
1171+
builder.info(
11721172
"Ignoring run-make test suite as they generally don't work without LLVM"
1173-
));
1173+
);
11741174
return;
11751175
}
11761176

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

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

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

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

0 commit comments

Comments
 (0)