Skip to content

Commit e026b59

Browse files
committed
Auto merge of #48694 - kennytm:rollup, r=kennytm
Rollup of 8 pull requests - Successful merges: #48283, #48466, #48569, #48629, #48637, #48680, #48513, #48664 - Failed merges:
2 parents 3b8bd53 + ea354b6 commit e026b59

File tree

16 files changed

+287
-44
lines changed

16 files changed

+287
-44
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@
5050
[submodule "src/llvm-emscripten"]
5151
path = src/llvm-emscripten
5252
url = https://github.com/rust-lang/llvm
53+
[submodule "src/stdsimd"]
54+
path = src/stdsimd
55+
url = https://github.com/rust-lang-nursery/stdsimd

config.toml.example

+3
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@
321321
# bootstrap)
322322
#codegen-backends = ["llvm"]
323323

324+
# This is the name of the directory in which codegen backends will get installed
325+
#codegen-backends-dir = "codegen-backends"
326+
324327
# Flag indicating whether `libstd` calls an imported function to handle basic IO
325328
# when targeting WebAssembly. Enable this to debug tests for the `wasm32-unknown-unknown`
326329
# target, as without this option the test output will not be captured.

src/bootstrap/bootstrap.py

+23-25
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ def __init__(self):
314314
self.build_dir = os.path.join(os.getcwd(), "build")
315315
self.clean = False
316316
self.config_toml = ''
317-
self.printed = False
318317
self.rust_root = os.path.abspath(os.path.join(__file__, '../../..'))
319318
self.use_locked_deps = ''
320319
self.use_vendored_sources = ''
@@ -336,7 +335,6 @@ def download_stage0(self):
336335
if self.rustc().startswith(self.bin_root()) and \
337336
(not os.path.exists(self.rustc()) or
338337
self.program_out_of_date(self.rustc_stamp())):
339-
self.print_what_bootstrap_means()
340338
if os.path.exists(self.bin_root()):
341339
shutil.rmtree(self.bin_root())
342340
filename = "rust-std-{}-{}.tar.gz".format(
@@ -351,10 +349,17 @@ def download_stage0(self):
351349
with open(self.rustc_stamp(), 'w') as rust_stamp:
352350
rust_stamp.write(self.date)
353351

352+
# This is required so that we don't mix incompatible MinGW
353+
# libraries/binaries that are included in rust-std with
354+
# the system MinGW ones.
355+
if "pc-windows-gnu" in self.build:
356+
filename = "rust-mingw-{}-{}.tar.gz".format(
357+
rustc_channel, self.build)
358+
self._download_stage0_helper(filename, "rust-mingw")
359+
354360
if self.cargo().startswith(self.bin_root()) and \
355361
(not os.path.exists(self.cargo()) or
356362
self.program_out_of_date(self.cargo_stamp())):
357-
self.print_what_bootstrap_means()
358363
filename = "cargo-{}-{}.tar.gz".format(cargo_channel, self.build)
359364
self._download_stage0_helper(filename, "cargo")
360365
self.fix_executable("{}/bin/cargo".format(self.bin_root()))
@@ -555,23 +560,6 @@ def exe_suffix():
555560
return '.exe'
556561
return ''
557562

558-
def print_what_bootstrap_means(self):
559-
"""Prints more information about the build system"""
560-
if hasattr(self, 'printed'):
561-
return
562-
self.printed = True
563-
if os.path.exists(self.bootstrap_binary()):
564-
return
565-
if '--help' not in sys.argv or len(sys.argv) == 1:
566-
return
567-
568-
print('info: the build system for Rust is written in Rust, so this')
569-
print(' script is now going to download a stage0 rust compiler')
570-
print(' and then compile the build system itself')
571-
print('')
572-
print('info: in the meantime you can read more about rustbuild at')
573-
print(' src/bootstrap/README.md before the download finishes')
574-
575563
def bootstrap_binary(self):
576564
"""Return the path of the boostrap binary
577565
@@ -585,7 +573,6 @@ def bootstrap_binary(self):
585573

586574
def build_bootstrap(self):
587575
"""Build bootstrap"""
588-
self.print_what_bootstrap_means()
589576
build_dir = os.path.join(self.build_dir, "bootstrap")
590577
if self.clean and os.path.exists(build_dir):
591578
shutil.rmtree(build_dir)
@@ -670,8 +657,16 @@ def set_dev_environment(self):
670657
self._download_url = 'https://dev-static.rust-lang.org'
671658

672659

673-
def bootstrap():
660+
def bootstrap(help_triggered):
674661
"""Configure, fetch, build and run the initial bootstrap"""
662+
663+
# If the user is asking for help, let them know that the whole download-and-build
664+
# process has to happen before anything is printed out.
665+
if help_triggered:
666+
print("info: Downloading and building bootstrap before processing --help")
667+
print(" command. See src/bootstrap/README.md for help with common")
668+
print(" commands.")
669+
675670
parser = argparse.ArgumentParser(description='Build rust')
676671
parser.add_argument('--config')
677672
parser.add_argument('--build')
@@ -708,7 +703,7 @@ def bootstrap():
708703
print(' and so in order to preserve your $HOME this will now')
709704
print(' use vendored sources by default. Note that if this')
710705
print(' does not work you should run a normal build first')
711-
print(' before running a command like `sudo make install`')
706+
print(' before running a command like `sudo ./x.py install`')
712707

713708
if build.use_vendored_sources:
714709
if not os.path.exists('.cargo'):
@@ -734,7 +729,10 @@ def bootstrap():
734729
if 'dev' in data:
735730
build.set_dev_environment()
736731

737-
build.update_submodules()
732+
# No help text depends on submodules. This check saves ~1 minute of git commands, even if
733+
# all the submodules are present and downloaded!
734+
if not help_triggered:
735+
build.update_submodules()
738736

739737
# Fetch/build the bootstrap
740738
build.build = args.build or build.build_triple()
@@ -760,7 +758,7 @@ def main():
760758
help_triggered = (
761759
'-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1)
762760
try:
763-
bootstrap()
761+
bootstrap(help_triggered)
764762
if not help_triggered:
765763
print("Build completed successfully in {}".format(
766764
format_build_time(time() - start_time)))

src/bootstrap/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ impl<'a> Builder<'a> {
464464

465465
pub fn sysroot_codegen_backends(&self, compiler: Compiler) -> PathBuf {
466466
self.sysroot_libdir(compiler, compiler.host)
467-
.with_file_name("codegen-backends")
467+
.with_file_name(self.build.config.rust_codegen_backends_dir.clone())
468468
}
469469

470470
/// Returns the compiler's libdir where it stores the dynamic libraries that

src/bootstrap/compile.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,8 @@ fn rustc_cargo_env(build: &Build, cargo: &mut Command) {
514514
cargo.env("CFG_RELEASE", build.rust_release())
515515
.env("CFG_RELEASE_CHANNEL", &build.config.channel)
516516
.env("CFG_VERSION", build.rust_version())
517-
.env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default());
517+
.env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default())
518+
.env("CFG_CODEGEN_BACKENDS_DIR", &build.config.rust_codegen_backends_dir);
518519

519520
let libdir_relative = build.config.libdir_relative().unwrap_or(Path::new("lib"));
520521
cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);

src/bootstrap/config.rs

+5
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ pub struct Config {
9696
pub rust_debuginfo_tests: bool,
9797
pub rust_dist_src: bool,
9898
pub rust_codegen_backends: Vec<Interned<String>>,
99+
pub rust_codegen_backends_dir: String,
99100

100101
pub build: Interned<String>,
101102
pub hosts: Vec<Interned<String>>,
@@ -289,6 +290,7 @@ struct Rust {
289290
test_miri: Option<bool>,
290291
save_toolstates: Option<String>,
291292
codegen_backends: Option<Vec<String>>,
293+
codegen_backends_dir: Option<String>,
292294
wasm_syscall: Option<bool>,
293295
}
294296

@@ -330,6 +332,7 @@ impl Config {
330332
config.rust_dist_src = true;
331333
config.test_miri = false;
332334
config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")];
335+
config.rust_codegen_backends_dir = "codegen-backends".to_owned();
333336

334337
config.rustc_error_format = flags.rustc_error_format;
335338
config.on_fail = flags.on_fail;
@@ -488,6 +491,8 @@ impl Config {
488491
.collect();
489492
}
490493

494+
set(&mut config.rust_codegen_backends_dir, rust.codegen_backends_dir.clone());
495+
491496
match rust.codegen_units {
492497
Some(0) => config.rust_codegen_units = Some(num_cpus::get() as u32),
493498
Some(n) => config.rust_codegen_units = Some(n),

src/bootstrap/dist.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,8 @@ impl Step for Std {
590590
let mut src = builder.sysroot_libdir(compiler, target).to_path_buf();
591591
src.pop(); // Remove the trailing /lib folder from the sysroot_libdir
592592
cp_filtered(&src, &dst, &|path| {
593-
path.file_name().and_then(|s| s.to_str()) != Some("codegen-backends")
593+
path.file_name().and_then(|s| s.to_str()) !=
594+
Some(build.config.rust_codegen_backends_dir.as_str())
594595
});
595596

596597
let mut cmd = rust_installer(builder);

src/bootstrap/doc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ fn invoke_rustdoc(builder: &Builder, compiler: Compiler, target: Interned<String
312312
cmd.arg("--html-after-content").arg(&footer)
313313
.arg("--html-before-content").arg(&version_info)
314314
.arg("--html-in-header").arg(&favicon)
315+
.arg("--markdown-no-toc")
315316
.arg("--markdown-playground-url")
316317
.arg("https://play.rust-lang.org/")
317318
.arg("-o").arg(&out)

src/libcore/lib.rs

+29-4
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,39 @@
6868
#![feature(allow_internal_unstable)]
6969
#![feature(asm)]
7070
#![feature(associated_type_defaults)]
71+
#![feature(attr_literals)]
7172
#![feature(cfg_target_feature)]
7273
#![feature(cfg_target_has_atomic)]
7374
#![feature(concat_idents)]
7475
#![feature(const_fn)]
7576
#![feature(custom_attribute)]
77+
#![feature(doc_spotlight)]
7678
#![feature(fundamental)]
7779
#![feature(i128_type)]
7880
#![feature(inclusive_range_syntax)]
7981
#![feature(intrinsics)]
82+
#![feature(iterator_flatten)]
83+
#![feature(iterator_repeat_with)]
8084
#![feature(lang_items)]
85+
#![feature(link_llvm_intrinsics)]
8186
#![feature(never_type)]
8287
#![feature(no_core)]
8388
#![feature(on_unimplemented)]
8489
#![feature(optin_builtin_traits)]
8590
#![feature(prelude_import)]
8691
#![feature(repr_simd, platform_intrinsics)]
8792
#![feature(rustc_attrs)]
93+
#![feature(rustc_const_unstable)]
94+
#![feature(simd_ffi)]
8895
#![feature(specialization)]
8996
#![feature(staged_api)]
97+
#![feature(stmt_expr_attributes)]
98+
#![feature(target_feature)]
9099
#![feature(unboxed_closures)]
91100
#![feature(untagged_unions)]
92101
#![feature(unwind_attributes)]
93-
#![feature(doc_spotlight)]
94-
#![feature(rustc_const_unstable)]
95-
#![feature(iterator_repeat_with)]
96-
#![feature(iterator_flatten)]
102+
103+
#![cfg_attr(stage0, allow(unused_attributes))]
97104

98105
#[prelude_import]
99106
#[allow(unused)]
@@ -179,3 +186,21 @@ mod char_private;
179186
mod iter_private;
180187
mod tuple;
181188
mod unit;
189+
190+
// Pull in the the `coresimd` crate directly into libcore. This is where all the
191+
// architecture-specific (and vendor-specific) intrinsics are defined. AKA
192+
// things like SIMD and such. Note that the actual source for all this lies in a
193+
// different repository, rust-lang-nursery/stdsimd. That's why the setup here is
194+
// a bit wonky.
195+
#[path = "../stdsimd/coresimd/mod.rs"]
196+
#[allow(missing_docs, missing_debug_implementations, dead_code)]
197+
#[unstable(feature = "stdsimd", issue = "48556")]
198+
#[cfg(not(stage0))] // allow changes to how stdsimd works in stage0
199+
mod coresimd;
200+
201+
#[unstable(feature = "stdsimd", issue = "48556")]
202+
#[cfg(not(stage0))]
203+
pub use coresimd::simd;
204+
#[unstable(feature = "stdsimd", issue = "48556")]
205+
#[cfg(not(stage0))]
206+
pub use coresimd::arch;

src/librustc_back/target/armv7_unknown_linux_musleabihf.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@ use LinkerFlavor;
1212
use target::{Target, TargetOptions, TargetResult};
1313

1414
pub fn target() -> TargetResult {
15-
let mut base = super::linux_musl_base::opts();
16-
17-
// Most of these settings are copied from the armv7_unknown_linux_gnueabihf
18-
// target.
19-
base.features = "+v7,+vfp3,+neon".to_string();
20-
base.cpu = "cortex-a8".to_string();
21-
base.max_atomic_width = Some(64);
15+
let base = super::linux_musl_base::opts();
2216
Ok(Target {
2317
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM
2418
// uses it to determine the calling convention and float ABI, and LLVM
@@ -33,9 +27,15 @@ pub fn target() -> TargetResult {
3327
target_env: "musl".to_string(),
3428
target_vendor: "unknown".to_string(),
3529
linker_flavor: LinkerFlavor::Gcc,
30+
31+
// Most of these settings are copied from the armv7_unknown_linux_gnueabihf
32+
// target.
3633
options: TargetOptions {
34+
features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(),
35+
cpu: "generic".to_string(),
36+
max_atomic_width: Some(64),
3737
abi_blacklist: super::arm_base::abi_blacklist(),
3838
.. base
39-
},
39+
}
4040
})
4141
}

src/librustc_driver/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ fn get_trans_sysroot(backend_name: &str) -> fn() -> Box<TransCrate> {
303303
let sysroot = sysroot_candidates.iter()
304304
.map(|sysroot| {
305305
let libdir = filesearch::relative_target_lib_path(&sysroot, &target);
306-
sysroot.join(libdir).with_file_name("codegen-backends")
306+
sysroot.join(libdir)
307+
.with_file_name(option_env!("CFG_CODEGEN_BACKENDS_DIR")
308+
.unwrap_or("codegen-backends"))
307309
})
308310
.filter(|f| {
309311
info!("codegen backend candidate: {}", f.display());

0 commit comments

Comments
 (0)