Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 5 pull requests #63389

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ffa4d7e
Sort the fat LTO modules to produce deterministic output.
jgalenson Aug 7, 2019
b9978e9
explain what we want and what not in .gitignore
RalfJung Aug 8, 2019
b2af718
we don't clutter the src/ dir any more
RalfJung Aug 8, 2019
58c231d
gitignore: remove some things that look ancient
RalfJung Aug 8, 2019
e82b053
move of packed fields might or might not occur when they actually are…
RalfJung Aug 8, 2019
9cea446
Cargo.toml is at the root these days
RalfJung Aug 8, 2019
fcb186d
fix typo in .gitignore
RalfJung Aug 8, 2019
06701a8
reduce visibility
matklad Aug 8, 2019
5b2c5e1
Sort fat LTO modules later and add a test.
jgalenson Aug 8, 2019
a46e36f
Fix fat LTO determinism test so it fails without the fix.
jgalenson Aug 8, 2019
c4a654d
bootstrap: get rid of TEST_MIRI env var
RalfJung Jul 30, 2019
ffb5f18
simplify a match
RalfJung Jul 31, 2019
78b6580
Miri test: call 'cargo miri test' and use the sysroot it has set up
RalfJung Jul 31, 2019
946bed8
remove test-miri flag from bootstrap
RalfJung Jul 31, 2019
2d49118
more comments
RalfJung Jul 31, 2019
295f894
remove test-miri from config.toml.example
RalfJung Aug 1, 2019
ceda774
dont test Miri by default (also be more verbose when being verbose)
RalfJung Aug 2, 2019
05aa983
let us try to find out where that panic is coming from
RalfJung Aug 2, 2019
03de7fd
install and use xargo inside the build dir
RalfJung Aug 3, 2019
82b3b82
don't set RUSTC_DEBUG_ASSERTIONS here; let cargo-miri do that
RalfJung Aug 3, 2019
e6be1d7
update miri
RalfJung Aug 8, 2019
4bde056
tweak ignores
RalfJung Aug 8, 2019
798767c
more alphabetical
RalfJung Aug 8, 2019
3e6a927
Explain why we're sorting the modules.
jgalenson Aug 8, 2019
fa58c27
remove confusing remark
RalfJung Aug 8, 2019
8abf29f
Rollup merge of #63162 - RalfJung:miri-xargo, r=alexcrichton
Centril Aug 8, 2019
ac84eb0
Rollup merge of #63352 - jgalenson:reproducible-lto, r=alexcrichton
Centril Aug 8, 2019
7cdb7ab
Rollup merge of #63373 - RalfJung:gitignore, r=alexcrichton
Centril Aug 8, 2019
a645f99
Rollup merge of #63374 - RalfJung:pin-packed, r=cramertj
Centril Aug 8, 2019
66657e7
Rollup merge of #63381 - matklad:reduce-visibility, r=Centril
Centril Aug 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 7 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 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.
*~
.#*
.DS_Store
Expand All @@ -14,20 +18,16 @@ __pycache__/
.valgrindrc
.vscode
.favorites.json
/*-*-*-*/
/*-*-*/
/Makefile
/build
/build/
/config.toml
/dist/
/dl/
/doc
/doc/
/inst/
/llvm/
/mingw-build/
/nd/
/obj/
/rt/
/rustllvm/
/src/libcore/unicode/DerivedCoreProperties.txt
/src/libcore/unicode/DerivedNormalizationProps.txt
Expand All @@ -37,11 +37,7 @@ __pycache__/
/src/libcore/unicode/SpecialCasing.txt
/src/libcore/unicode/UnicodeData.txt
/src/libcore/unicode/downloaded
/stage[0-9]+/
/target
target/
/test/
/tmp/
/target/
tags
tags.*
TAGS
Expand All @@ -50,17 +46,6 @@ 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/

no_llvm_build

4 changes: 0 additions & 4 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
46 changes: 0 additions & 46 deletions src/.gitignore

This file was deleted.

21 changes: 5 additions & 16 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -285,20 +288,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);
}
Expand Down
10 changes: 0 additions & 10 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -981,7 +972,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) {
Expand Down
4 changes: 0 additions & 4 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PathBuf>,
pub print_step_timings: bool,
pub missing_tools: bool,
Expand Down Expand Up @@ -315,7 +314,6 @@ struct Rust {
debug: Option<bool>,
dist_src: Option<bool>,
verbose_tests: Option<bool>,
test_miri: Option<bool>,
incremental: Option<bool>,
save_toolstates: Option<String>,
codegen_backends: Option<Vec<String>>,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 1 addition & 3 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
92 changes: 78 additions & 14 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,9 @@ pub struct Miri {
impl Step for Miri {
type Output = ();
const ONLY_HOSTS: bool = true;
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<'_>) {
Expand All @@ -389,26 +387,92 @@ 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`.
// As a side-effect, this will install xargo.
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"));
// 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;
}

// # 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 {
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");
// Output is "MIRI_SYSROOT=<str>\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");
}
Expand Down
2 changes: 1 addition & 1 deletion src/ci/azure-pipelines/auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
1 change: 0 additions & 1 deletion src/ci/docker/x86_64-gnu-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion src/libcore/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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. 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
Expand Down
7 changes: 5 additions & 2 deletions src/librustc_codegen_llvm/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ fn fat_lto(cgcx: &CodegenContext<LlvmCodegenBackend>,
// 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());
Expand All @@ -277,7 +277,10 @@ fn fat_lto(cgcx: &CodegenContext<LlvmCodegenBackend>,
(SerializedModule::Local(buffer), llmod_id)
}
}
}));
}).collect::<Vec<_>>();
// 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)| {
(buffer, CString::new(wp.cgu_name).unwrap())
}));
Expand Down
Loading