From ffa4d7e87f7565177693eefb4650bb32c3498968 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Wed, 7 Aug 2019 09:30:16 -0700 Subject: [PATCH 01/25] Sort the fat LTO modules to produce deterministic output. --- src/librustc_codegen_ssa/back/write.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index c9e4663fdbddf..2bd46b9f6efee 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -755,6 +755,15 @@ pub enum FatLTOInput { InMemory(ModuleCodegen), } +impl FatLTOInput { + fn name(&'a self) -> &'a String { + match self { + FatLTOInput::Serialized { name, buffer: _ } => &name, + FatLTOInput::InMemory(module) => &module.name, + } + } +} + fn execute_work_item( cgcx: &CodegenContext, work_item: WorkItem, @@ -1345,10 +1354,15 @@ fn start_executing_work( assert!(!started_lto); started_lto = true; - let needs_fat_lto = mem::take(&mut needs_fat_lto); + let mut needs_fat_lto: Vec> = mem::take(&mut needs_fat_lto); let needs_thin_lto = mem::take(&mut needs_thin_lto); let import_only_modules = mem::take(&mut lto_import_only_modules); + // Regardless of what order these modules completed in, report them to + // the backend in the same order every time to ensure that we're handing + // out deterministic results. + needs_fat_lto.sort_by(|m1, m2| m1.name().cmp(m2.name())); + for (work, cost) in generate_lto_work(&cgcx, needs_fat_lto, needs_thin_lto, import_only_modules) { let insertion_index = work_items From b9978e922054eabcadb442e2dd68e07afa1124f6 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 8 Aug 2019 08:49:58 +0200 Subject: [PATCH 02/25] explain what we want and what not in .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index b53b06b03cac6..64b5e577607ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# This file should only ignore things that are generatd during a build, +# generated by common IDEs, and optional files controlled by the user +# that affect the build (such as config.toml). +# FIXME: This needs cleanup. *~ .#* .DS_Store From b2af7187d96d3f28fe91380df14da40c5d55611f Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 8 Aug 2019 09:04:37 +0200 Subject: [PATCH 03/25] we don't clutter the src/ dir any more --- src/.gitignore | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 src/.gitignore diff --git a/src/.gitignore b/src/.gitignore deleted file mode 100644 index f1b36f5858037..0000000000000 --- a/src/.gitignore +++ /dev/null @@ -1,46 +0,0 @@ -*.a -*.aux -*.bc -*.boot -*.bz2 -*.cmi -*.cmo -*.cmx -*.cp -*.cps -*.d -*.dSYM -*.def -*.diff -*.dll -*.dylib -*.elc -*.epub -*.exe -*.fn -*.html -*.kdev4 -*.ky -*.ll -*.llvm -*.log -*.o -*.orig -*.out -*.patch -*.pdb -*.pdf -*.pg -*.pot -*.pyc -*.rej -*.rlib -*.rustc -*.so -*.swo -*.swp -*.tmp -*.toc -*.tp -*.vr -*.x86 From 58c231dce77d1c6b22cdd60581b802dcd3599f45 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 8 Aug 2019 09:11:32 +0200 Subject: [PATCH 04/25] gitignore: remove some things that look ancient --- .gitignore | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.gitignore b/.gitignore index 64b5e577607ee..860dc37129185 100644 --- a/.gitignore +++ b/.gitignore @@ -18,8 +18,6 @@ __pycache__/ .valgrindrc .vscode .favorites.json -/*-*-*-*/ -/*-*-*/ /Makefile /build /config.toml @@ -29,9 +27,6 @@ __pycache__/ /inst/ /llvm/ /mingw-build/ -/nd/ -/obj/ -/rt/ /rustllvm/ /src/libcore/unicode/DerivedCoreProperties.txt /src/libcore/unicode/DerivedNormalizationProps.txt @@ -41,11 +36,6 @@ __pycache__/ /src/libcore/unicode/SpecialCasing.txt /src/libcore/unicode/UnicodeData.txt /src/libcore/unicode/downloaded -/stage[0-9]+/ -/target -target/ -/test/ -/tmp/ tags tags.* TAGS @@ -54,14 +44,8 @@ TAGS.* \#*\# config.mk config.stamp -keywords.md -lexer.ml Session.vim src/etc/dl -tmp.*.rs -version.md -version.ml -version.texi .cargo !src/vendor/** /src/target/ From e82b053f56d11c944c227cefa6d2c2689346d49e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 8 Aug 2019 10:01:41 +0200 Subject: [PATCH 05/25] move of packed fields might or might not occur when they actually are sufficiently aligned --- src/libcore/pin.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index 88a56174629f9..251dc4c3b99b7 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -188,7 +188,8 @@ //! you do not accidentally use `self`/`this` in a way that is in conflict with pinning. //! //! Moreover, if your type is `#[repr(packed)]`, the compiler will automatically -//! move fields around to be able to drop them. As a consequence, you cannot use +//! move fields around to be able to drop them. In a packed struct, it might even do +//! that for fields that happen to be sufficiently aligned. As a consequence, you cannot use //! pinning with a `#[repr(packed)]` type. //! //! # Projections and Structural Pinning From 9cea446c6ccfbed372eb78866f7b5751361c60c8 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 8 Aug 2019 11:19:09 +0200 Subject: [PATCH 06/25] Cargo.toml is at the root these days --- .gitignore | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitignore b/.gitignore index 860dc37129185..5e536ccf615a1 100644 --- a/.gitignore +++ b/.gitignore @@ -47,8 +47,4 @@ config.stamp Session.vim src/etc/dl .cargo -!src/vendor/** -/src/target/ - no_llvm_build - From fcb186d0fef2431e8ddccff879d10b7101395827 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 8 Aug 2019 11:19:44 +0200 Subject: [PATCH 07/25] fix typo in .gitignore Co-Authored-By: Vadim Petrochenkov --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5e536ccf615a1..9515fa8c2f84d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# This file should only ignore things that are generatd during a build, +# This file should only ignore things that are generated during a build, # generated by common IDEs, and optional files controlled by the user # that affect the build (such as config.toml). # FIXME: This needs cleanup. From 06701a8dafa13a161fe552dae119e9282c71bd0a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 8 Aug 2019 16:58:06 +0200 Subject: [PATCH 08/25] reduce visibility --- src/libsyntax/source_map.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsyntax/source_map.rs b/src/libsyntax/source_map.rs index f83c1dbf7eed0..4e29c77c89e42 100644 --- a/src/libsyntax/source_map.rs +++ b/src/libsyntax/source_map.rs @@ -125,12 +125,12 @@ impl StableSourceFileId { #[derive(Default)] pub(super) struct SourceMapFiles { - pub(super) source_files: Vec>, + source_files: Vec>, stable_id_to_source_file: FxHashMap> } pub struct SourceMap { - pub(super) files: Lock, + files: Lock, file_loader: Box, // This is used to apply the file path remapping as specified via // --remap-path-prefix to all SourceFiles allocated within this SourceMap. From 5b2c5e181ac321f04621ef0b7dc78354bf3397d3 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Thu, 8 Aug 2019 07:54:27 -0700 Subject: [PATCH 09/25] Sort fat LTO modules later and add a test. --- src/librustc_codegen_llvm/back/lto.rs | 6 ++++-- src/librustc_codegen_ssa/back/write.rs | 16 +--------------- .../reproducible-build/Makefile | 11 ++++++++++- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/librustc_codegen_llvm/back/lto.rs b/src/librustc_codegen_llvm/back/lto.rs index 5d3cc0c0a255f..33b4c8eec54ce 100644 --- a/src/librustc_codegen_llvm/back/lto.rs +++ b/src/librustc_codegen_llvm/back/lto.rs @@ -265,7 +265,7 @@ fn fat_lto(cgcx: &CodegenContext, // and we want to move everything to the same LLVM context. Currently the // way we know of to do that is to serialize them to a string and them parse // them later. Not great but hey, that's why it's "fat" LTO, right? - serialized_modules.extend(modules.into_iter().map(|module| { + let mut new_modules = modules.into_iter().map(|module| { match module { FatLTOInput::InMemory(module) => { let buffer = ModuleBuffer::new(module.module_llvm.llmod()); @@ -277,7 +277,9 @@ fn fat_lto(cgcx: &CodegenContext, (SerializedModule::Local(buffer), llmod_id) } } - })); + }).collect::>(); + new_modules.sort_by(|module1, module2| module1.1.partial_cmp(&module2.1).unwrap()); + serialized_modules.extend(new_modules); serialized_modules.extend(cached_modules.into_iter().map(|(buffer, wp)| { (buffer, CString::new(wp.cgu_name).unwrap()) })); diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index 2bd46b9f6efee..c9e4663fdbddf 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -755,15 +755,6 @@ pub enum FatLTOInput { InMemory(ModuleCodegen), } -impl FatLTOInput { - fn name(&'a self) -> &'a String { - match self { - FatLTOInput::Serialized { name, buffer: _ } => &name, - FatLTOInput::InMemory(module) => &module.name, - } - } -} - fn execute_work_item( cgcx: &CodegenContext, work_item: WorkItem, @@ -1354,15 +1345,10 @@ fn start_executing_work( assert!(!started_lto); started_lto = true; - let mut needs_fat_lto: Vec> = mem::take(&mut needs_fat_lto); + let needs_fat_lto = mem::take(&mut needs_fat_lto); let needs_thin_lto = mem::take(&mut needs_thin_lto); let import_only_modules = mem::take(&mut lto_import_only_modules); - // Regardless of what order these modules completed in, report them to - // the backend in the same order every time to ensure that we're handing - // out deterministic results. - needs_fat_lto.sort_by(|m1, m2| m1.name().cmp(m2.name())); - for (work, cost) in generate_lto_work(&cgcx, needs_fat_lto, needs_thin_lto, import_only_modules) { let insertion_index = work_items diff --git a/src/test/run-make-fulldeps/reproducible-build/Makefile b/src/test/run-make-fulldeps/reproducible-build/Makefile index a17ec212cfd58..5b9c9d3d03521 100644 --- a/src/test/run-make-fulldeps/reproducible-build/Makefile +++ b/src/test/run-make-fulldeps/reproducible-build/Makefile @@ -10,7 +10,8 @@ all: \ link_paths \ remap_paths \ different_source_dirs \ - extern_flags + extern_flags \ + fat_lto smoke: rm -rf $(TMPDIR) && mkdir $(TMPDIR) @@ -76,3 +77,11 @@ extern_flags: --extern reproducible_build_aux=$(TMPDIR)/libbar.rlib \ --crate-type rlib cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 + +fat_lto: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + $(RUSTC) reproducible-build.rs -C lto=fat + cp $(TMPDIR)/reproducible-build $(TMPDIR)/reproducible-build-a + $(RUSTC) reproducible-build.rs -C lto=fat + cmp "$(TMPDIR)/reproducible-build-a" "$(TMPDIR)/reproducible-build" || exit 1 From a46e36f9df68f9c59157ccc3c1519413802993b5 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Thu, 8 Aug 2019 09:05:32 -0700 Subject: [PATCH 10/25] Fix fat LTO determinism test so it fails without the fix. --- src/test/run-make-fulldeps/reproducible-build/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/run-make-fulldeps/reproducible-build/Makefile b/src/test/run-make-fulldeps/reproducible-build/Makefile index 5b9c9d3d03521..addbf9928bf4a 100644 --- a/src/test/run-make-fulldeps/reproducible-build/Makefile +++ b/src/test/run-make-fulldeps/reproducible-build/Makefile @@ -81,7 +81,7 @@ extern_flags: fat_lto: rm -rf $(TMPDIR) && mkdir $(TMPDIR) $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs -C lto=fat + $(RUSTC) reproducible-build.rs -C lto=fat -C opt-level=1 cp $(TMPDIR)/reproducible-build $(TMPDIR)/reproducible-build-a - $(RUSTC) reproducible-build.rs -C lto=fat + $(RUSTC) reproducible-build.rs -C lto=fat -C opt-level=1 cmp "$(TMPDIR)/reproducible-build-a" "$(TMPDIR)/reproducible-build" || exit 1 From c4a654d9cdbf259b4ec563df22787c31a3149b93 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 30 Jul 2019 21:23:59 +0200 Subject: [PATCH 11/25] bootstrap: get rid of TEST_MIRI env var --- src/bootstrap/bin/rustc.rs | 14 -------------- src/bootstrap/builder.rs | 1 - 2 files changed, 15 deletions(-) diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 23f81c2c87692..672b2ee14430c 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -285,20 +285,6 @@ fn main() { } } - // When running miri tests, we need to generate MIR for all libraries - if env::var("TEST_MIRI").ok().map_or(false, |val| val == "true") { - // The flags here should be kept in sync with `add_miri_default_args` - // in miri's `src/lib.rs`. - cmd.arg("-Zalways-encode-mir"); - cmd.arg("--cfg=miri"); - // These options are preferred by miri, to be able to perform better validation, - // but the bootstrap compiler might not understand them. - if stage != "0" { - cmd.arg("-Zmir-emit-retag"); - cmd.arg("-Zmir-opt-level=0"); - } - } - if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") { cmd.arg("--remap-path-prefix").arg(&map); } diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 5a75497173eb3..52e37bfa1b0fd 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -981,7 +981,6 @@ impl<'a> Builder<'a> { PathBuf::from("/path/to/nowhere/rustdoc/not/required") }, ) - .env("TEST_MIRI", self.config.test_miri.to_string()) .env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir()); if let Some(host_linker) = self.linker(compiler.host) { From ffb5f18a520c92f6a26039b75f9e72ddbb985435 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 31 Jul 2019 09:01:42 +0200 Subject: [PATCH 12/25] simplify a match --- src/bootstrap/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index c8ea3157dc92b..b72aa78f3de19 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -540,9 +540,7 @@ impl Build { Mode::Rustc => "-rustc", Mode::Codegen => "-codegen", Mode::ToolBootstrap => "-bootstrap-tools", - Mode::ToolStd => "-tools", - Mode::ToolTest => "-tools", - Mode::ToolRustc => "-tools", + Mode::ToolStd | Mode::ToolTest | Mode::ToolRustc => "-tools", }; self.out.join(&*compiler.host) .join(format!("stage{}{}", compiler.stage, suffix)) From 78b658004cce335b19743cd5406dd3c5ecfe824b Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 31 Jul 2019 15:24:09 +0200 Subject: [PATCH 13/25] Miri test: call 'cargo miri test' and use the sysroot it has set up --- src/bootstrap/bin/rustc.rs | 7 +++- src/bootstrap/test.rs | 82 +++++++++++++++++++++++++++++++++----- 2 files changed, 76 insertions(+), 13 deletions(-) diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 672b2ee14430c..54b689fb062a5 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -143,8 +143,11 @@ fn main() { if let Some(target) = target { // The stage0 compiler has a special sysroot distinct from what we - // actually downloaded, so we just always pass the `--sysroot` option. - cmd.arg("--sysroot").arg(&sysroot); + // actually downloaded, so we just always pass the `--sysroot` option, + // unless one is already set. + if !args.iter().any(|arg| arg == "--sysroot") { + cmd.arg("--sysroot").arg(&sysroot); + } cmd.arg("-Zexternal-macro-backtrace"); diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index e5b0a46ba6fb6..5a1f8ead9f2c4 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -389,26 +389,86 @@ impl Step for Miri { extra_features: Vec::new(), }); if let Some(miri) = miri { - let mut cargo = tool::prepare_tool_cargo(builder, - compiler, - Mode::ToolRustc, - host, - "test", - "src/tools/miri", - SourceType::Submodule, - &[]); + // # Run `cargo miri setup`. + let mut cargo = tool::prepare_tool_cargo( + builder, + compiler, + Mode::ToolRustc, + host, + "run", + "src/tools/miri", + SourceType::Submodule, + &[], + ); + cargo + .arg("--bin") + .arg("cargo-miri") + .arg("--") + .arg("miri") + .arg("setup"); + + // Tell `cargo miri` not to worry about the sysroot mismatch (we built with + // stage1 but run with stage2). + cargo.env("MIRI_SKIP_SYSROOT_CHECK", "1"); + // Tell `cargo miri setup` where to find the sources. + cargo.env("XARGO_RUST_SRC", builder.src.join("src")); + // Make sure the libstd gets built without debug assertions. + cargo.env("RUSTC_DEBUG_ASSERTIONS", "false"); + + if !try_run(builder, &mut cargo) { + return; + } + + // # Determine where Miri put its sysroot. + // To this end, we run `cargo miri setup --env` and capture the output. + // (We do this separately from the above so that when the setup actually + // happens we get some output.) + // We re-use the `cargo` from above. + cargo.arg("--env"); + + // FIXME: Is there a way in which we can re-use the usual `run` helpers? + let miri_sysroot = if builder.config.dry_run { + String::new() + } else { + let out = cargo.output() + .expect("We already ran `cargo miri setup` before and that worked"); + assert!(out.status.success(), "`cargo miri setup` returned with non-0 exit code"); + // Output is "MIRI_SYSROOT=\n". + let stdout = String::from_utf8(out.stdout) + .expect("`cargo miri setup` stdout is not valid UTF-8"); + let stdout = stdout.trim(); + builder.verbose(&format!("`cargo miri setup --env` returned: {:?}", stdout)); + let sysroot = stdout.splitn(2, '=') + .nth(1).expect("`cargo miri setup` stdout did not contain '='"); + sysroot.to_owned() + }; + + // # Run `cargo test`. + let mut cargo = tool::prepare_tool_cargo( + builder, + compiler, + Mode::ToolRustc, + host, + "test", + "src/tools/miri", + SourceType::Submodule, + &[], + ); // miri tests need to know about the stage sysroot - cargo.env("MIRI_SYSROOT", builder.sysroot(compiler)); + cargo.env("MIRI_SYSROOT", miri_sysroot); cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler)); cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler)); cargo.env("MIRI_PATH", miri); builder.add_rustc_lib_path(compiler, &mut cargo); - if try_run(builder, &mut cargo) { - builder.save_toolstate("miri", ToolState::TestPass); + if !try_run(builder, &mut cargo) { + return; } + + // # Done! + builder.save_toolstate("miri", ToolState::TestPass); } else { eprintln!("failed to test miri: could not build"); } From 946bed89da398187c77e9ef7d7b4c69e64deaba5 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 31 Jul 2019 15:26:56 +0200 Subject: [PATCH 14/25] remove test-miri flag from bootstrap --- src/bootstrap/builder.rs | 9 --------- src/bootstrap/config.rs | 4 ---- src/bootstrap/configure.py | 1 - src/bootstrap/test.rs | 3 +-- src/ci/azure-pipelines/auto.yml | 2 +- src/ci/docker/x86_64-gnu-tools/Dockerfile | 1 - 6 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 52e37bfa1b0fd..e54c9360baece 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -543,15 +543,6 @@ impl<'a> Builder<'a> { parent: Cell::new(None), }; - if kind == Kind::Dist { - assert!( - !builder.config.test_miri, - "Do not distribute with miri enabled.\n\ - The distributed libraries would include all MIR (increasing binary size). - The distributed MIR would include validation statements." - ); - } - builder } diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 5a5f4ac725204..a5bfafdfdb4dc 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -128,7 +128,6 @@ pub struct Config { pub low_priority: bool, pub channel: String, pub verbose_tests: bool, - pub test_miri: bool, pub save_toolstates: Option, pub print_step_timings: bool, pub missing_tools: bool, @@ -315,7 +314,6 @@ struct Rust { debug: Option, dist_src: Option, verbose_tests: Option, - test_miri: Option, incremental: Option, save_toolstates: Option, codegen_backends: Option>, @@ -375,7 +373,6 @@ impl Config { config.codegen_tests = true; config.ignore_git = false; config.rust_dist_src = true; - config.test_miri = false; config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")]; config.rust_codegen_backends_dir = "codegen-backends".to_owned(); config.deny_warnings = true; @@ -557,7 +554,6 @@ impl Config { set(&mut config.channel, rust.channel.clone()); set(&mut config.rust_dist_src, rust.dist_src); set(&mut config.verbose_tests, rust.verbose_tests); - set(&mut config.test_miri, rust.test_miri); // in the case "false" is set explicitly, do not overwrite the command line args if let Some(true) = rust.incremental { config.incremental = true; diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 298330869b684..346f0cb2039c0 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -36,7 +36,6 @@ def v(*args): o("compiler-docs", "build.compiler-docs", "build compiler documentation") o("optimize-tests", "rust.optimize-tests", "build tests with optimizations") o("parallel-compiler", "rust.parallel-compiler", "build a multi-threaded rustc") -o("test-miri", "rust.test-miri", "run miri's test suite") o("verbose-tests", "rust.verbose-tests", "enable verbose output when running tests") o("ccache", "llvm.ccache", "invoke gcc/clang via ccache to reuse object files between builds") o("sccache", None, "invoke gcc/clang via sccache to reuse object files between builds") diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 5a1f8ead9f2c4..79d8b867cb61e 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -366,8 +366,7 @@ impl Step for Miri { const DEFAULT: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - let test_miri = run.builder.config.test_miri; - run.path("src/tools/miri").default_condition(test_miri) + run.path("src/tools/miri") } fn make_run(run: RunConfig<'_>) { diff --git a/src/ci/azure-pipelines/auto.yml b/src/ci/azure-pipelines/auto.yml index 6ed1585c5168b..687856cca6b62 100644 --- a/src/ci/azure-pipelines/auto.yml +++ b/src/ci/azure-pipelines/auto.yml @@ -254,7 +254,7 @@ jobs: x86_64-msvc-tools: MSYS_BITS: 64 SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstates.json windows - RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstates.json --enable-test-miri + RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstates.json # 32/64-bit MinGW builds. # diff --git a/src/ci/docker/x86_64-gnu-tools/Dockerfile b/src/ci/docker/x86_64-gnu-tools/Dockerfile index bab9145cbcb9c..f11ae7a34cb91 100644 --- a/src/ci/docker/x86_64-gnu-tools/Dockerfile +++ b/src/ci/docker/x86_64-gnu-tools/Dockerfile @@ -23,6 +23,5 @@ COPY x86_64-gnu-tools/repo.sh /tmp/ ENV RUST_CONFIGURE_ARGS \ --build=x86_64-unknown-linux-gnu \ - --enable-test-miri \ --save-toolstates=/tmp/toolstates.json ENV SCRIPT /tmp/checktools.sh ../x.py /tmp/toolstates.json linux From 2d49118fb4847de19c5263b1c8789c9ef600461a Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 31 Jul 2019 15:39:30 +0200 Subject: [PATCH 15/25] more comments --- src/bootstrap/test.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 79d8b867cb61e..58a0b5dde2e09 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -389,6 +389,7 @@ impl Step for Miri { }); if let Some(miri) = miri { // # Run `cargo miri setup`. + // As a side-effect, this will install xargo. let mut cargo = tool::prepare_tool_cargo( builder, compiler, From 295f894b18fedd1ff5748ef122166840a8b83e3c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 1 Aug 2019 21:06:25 +0200 Subject: [PATCH 16/25] remove test-miri from config.toml.example --- config.toml.example | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config.toml.example b/config.toml.example index 6816eaeaa9486..cb9f388a8e47b 100644 --- a/config.toml.example +++ b/config.toml.example @@ -368,10 +368,6 @@ # When creating source tarballs whether or not to create a source tarball. #dist-src = false -# Whether to also run the Miri tests suite when running tests. -# As a side-effect also generates MIR for all libraries. -#test-miri = false - # After building or testing extended tools (e.g. clippy and rustfmt), append the # result (broken, compiling, testing) into this JSON file. #save-toolstates = "/path/to/toolstates.json" From ceda77486f8a37f85326f38bfc7509eea4c38ce9 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 2 Aug 2019 17:56:55 +0200 Subject: [PATCH 17/25] dont test Miri by default (also be more verbose when being verbose) --- src/bootstrap/test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 58a0b5dde2e09..00a2802ba8143 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -363,7 +363,6 @@ pub struct Miri { impl Step for Miri { type Output = (); const ONLY_HOSTS: bool = true; - const DEFAULT: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { run.path("src/tools/miri") @@ -430,6 +429,7 @@ impl Step for Miri { let miri_sysroot = if builder.config.dry_run { String::new() } else { + builder.verbose(&format!("running: {:?}", cargo)); let out = cargo.output() .expect("We already ran `cargo miri setup` before and that worked"); assert!(out.status.success(), "`cargo miri setup` returned with non-0 exit code"); From 05aa983f4c3fa10de98be229451b32fdd5fa7c49 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 2 Aug 2019 14:20:42 +0200 Subject: [PATCH 18/25] let us try to find out where that panic is coming from --- src/bootstrap/test.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 00a2802ba8143..8b8b38b15098f 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -413,6 +413,8 @@ impl Step for Miri { cargo.env("XARGO_RUST_SRC", builder.src.join("src")); // Make sure the libstd gets built without debug assertions. cargo.env("RUSTC_DEBUG_ASSERTIONS", "false"); + // Debug things. + cargo.env("RUST_BACKTRACE", "1"); if !try_run(builder, &mut cargo) { return; From 03de7fdbfacb176394c257e7ce921466c1af378c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 3 Aug 2019 14:30:57 +0200 Subject: [PATCH 19/25] install and use xargo inside the build dir --- src/bootstrap/test.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 8b8b38b15098f..1850d60f139c9 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -415,6 +415,10 @@ impl Step for Miri { cargo.env("RUSTC_DEBUG_ASSERTIONS", "false"); // Debug things. cargo.env("RUST_BACKTRACE", "1"); + // Configure `cargo install` path, and let cargo-miri know that that's where + // xargo ends up. + cargo.env("CARGO_INSTALL_ROOT", &builder.out); // cargo adds a `bin/` + cargo.env("XARGO", builder.out.join("bin").join("xargo")); if !try_run(builder, &mut cargo) { return; From 82b3b8229b2a99d499220caa0712cca02b697c70 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 3 Aug 2019 17:26:01 +0200 Subject: [PATCH 20/25] don't set RUSTC_DEBUG_ASSERTIONS here; let cargo-miri do that --- src/bootstrap/test.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 1850d60f139c9..c2c134bfd1d7d 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -411,8 +411,6 @@ impl Step for Miri { cargo.env("MIRI_SKIP_SYSROOT_CHECK", "1"); // Tell `cargo miri setup` where to find the sources. cargo.env("XARGO_RUST_SRC", builder.src.join("src")); - // Make sure the libstd gets built without debug assertions. - cargo.env("RUSTC_DEBUG_ASSERTIONS", "false"); // Debug things. cargo.env("RUST_BACKTRACE", "1"); // Configure `cargo install` path, and let cargo-miri know that that's where From e6be1d713497a47ddbcedd2776d999fe4324cc16 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 8 Aug 2019 19:32:33 +0200 Subject: [PATCH 21/25] update miri --- src/tools/miri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri b/src/tools/miri index 39a524f694e42..b12ebfc3de853 160000 --- a/src/tools/miri +++ b/src/tools/miri @@ -1 +1 @@ -Subproject commit 39a524f694e42cfb178639d490d3fdbbaf8569dc +Subproject commit b12ebfc3de853abf6b4260c44a71cd51323803c5 From 4bde056ed22a8c2904855258519fc5581ebe340b Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 8 Aug 2019 19:42:46 +0200 Subject: [PATCH 22/25] tweak ignores --- .gitignore | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 9515fa8c2f84d..d4077351e084d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,14 +19,16 @@ __pycache__/ .vscode .favorites.json /Makefile -/build +/build/ +/target/ /config.toml /dist/ /dl/ -/doc +/doc/ /inst/ /llvm/ /mingw-build/ +/obj/ /rustllvm/ /src/libcore/unicode/DerivedCoreProperties.txt /src/libcore/unicode/DerivedNormalizationProps.txt @@ -45,6 +47,5 @@ TAGS.* config.mk config.stamp Session.vim -src/etc/dl .cargo no_llvm_build From 798767ca2119a9557c6180d271ae039987d342dc Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 8 Aug 2019 19:43:44 +0200 Subject: [PATCH 23/25] more alphabetical --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d4077351e084d..a0b491f42789a 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ __pycache__/ .favorites.json /Makefile /build/ -/target/ /config.toml /dist/ /dl/ @@ -38,6 +37,7 @@ __pycache__/ /src/libcore/unicode/SpecialCasing.txt /src/libcore/unicode/UnicodeData.txt /src/libcore/unicode/downloaded +/target/ tags tags.* TAGS From 3e6a9273057aec611b9f22025bb28355060af265 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Thu, 8 Aug 2019 10:51:52 -0700 Subject: [PATCH 24/25] Explain why we're sorting the modules. --- src/librustc_codegen_llvm/back/lto.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustc_codegen_llvm/back/lto.rs b/src/librustc_codegen_llvm/back/lto.rs index 33b4c8eec54ce..5ed08943fe6fd 100644 --- a/src/librustc_codegen_llvm/back/lto.rs +++ b/src/librustc_codegen_llvm/back/lto.rs @@ -278,6 +278,7 @@ fn fat_lto(cgcx: &CodegenContext, } } }).collect::>(); + // Sort the modules to ensure we produce deterministic results. new_modules.sort_by(|module1, module2| module1.1.partial_cmp(&module2.1).unwrap()); serialized_modules.extend(new_modules); serialized_modules.extend(cached_modules.into_iter().map(|(buffer, wp)| { From fa58c278300895aad254342c89aafa7c080877b3 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 8 Aug 2019 21:02:11 +0200 Subject: [PATCH 25/25] remove confusing remark --- src/libcore/pin.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index 251dc4c3b99b7..271ddcc4662cf 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -188,7 +188,7 @@ //! you do not accidentally use `self`/`this` in a way that is in conflict with pinning. //! //! Moreover, if your type is `#[repr(packed)]`, the compiler will automatically -//! move fields around to be able to drop them. In a packed struct, it might even do +//! move fields around to be able to drop them. It might even do //! that for fields that happen to be sufficiently aligned. As a consequence, you cannot use //! pinning with a `#[repr(packed)]` type. //!