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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Eric Holk <eric.holk@gmail.com> <eholk@mozilla.com>
7878
Eric Holmes <eric@ejholmes.net>
7979
Eric Reed <ecreed@cs.washington.edu> <ereed@mozilla.com>
8080
Erick Tryzelaar <erick.tryzelaar@gmail.com> <etryzelaar@iqt.org>
81+
Esteban Küber <esteban@kuber.com.ar> <estebank@users.noreply.github.com> <esteban@commure.com> <github@kuber.com.ar>
8182
Evgeny Sologubov
8283
Falco Hirschenberger <falco.hirschenberger@gmail.com> <hirschen@itwm.fhg.de>
8384
Felix S. Klock II <pnkfelix@pnkfx.org> Felix S Klock II <pnkfelix@pnkfx.org>

RELEASES.md

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 9 additions & 4 deletions
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 12 additions & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 9 additions & 10 deletions
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())

0 commit comments

Comments
 (0)