Skip to content

update Miri #112244

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

Merged
merged 27 commits into from
Jun 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0f5ac83
Hide full miri command line in `./miri run-dep`
oli-obk May 23, 2023
053edf4
Auto merge of #2901 - oli-obk:noisy, r=RalfJung
bors May 23, 2023
9ffd3f9
Preparing for merge from rustc
saethlin May 26, 2023
ad60608
Merge from rustc
saethlin May 26, 2023
5a54d34
rustup
saethlin May 26, 2023
3b181ac
Auto merge of #2902 - saethlin:rustup, r=RalfJung
bors May 26, 2023
cb75f21
more precise filtering of events
Vanille-N May 10, 2023
c5013ce
Preparing for merge from rustc
saethlin May 29, 2023
fe69acf
Merge from rustc
saethlin May 29, 2023
7bef7b7
Auto merge of #2903 - saethlin:rustup, r=RalfJung
bors May 29, 2023
4cff01e
Preparing for merge from rustc
saethlin May 30, 2023
55df622
Merge from rustc
saethlin May 30, 2023
f9cff63
Auto merge of #2905 - saethlin:rustup, r=saethlin
bors May 30, 2023
1ac9162
Auto merge of #2888 - Vanille-N:tb-diags, r=RalfJung
bors May 31, 2023
70e6b26
Preparing for merge from rustc
RalfJung May 31, 2023
5304e40
Merge from rustc
RalfJung May 31, 2023
bfc897e
CI: test ./miri bench
RalfJung May 31, 2023
fb35803
Auto merge of #2907 - RalfJung:rustup, r=RalfJung
bors May 31, 2023
91cb951
miri-script: Transform Windows paths to unix.
osiewicz May 5, 2023
47bf8e7
Auto merge of #2908 - RalfJung:bench, r=oli-obk
bors May 31, 2023
777db72
Preparing for merge from rustc
RalfJung Jun 2, 2023
c5aebfb
Merge from rustc
RalfJung Jun 2, 2023
be4e05a
fmt
RalfJung Jun 2, 2023
507055b
Auto merge of #2911 - RalfJung:rustup, r=RalfJung
bors Jun 2, 2023
e13d238
add unchecked_shl test
RalfJung Jun 3, 2023
df4b808
Auto merge of #2914 - RalfJung:unchecked_shl, r=RalfJung
bors Jun 3, 2023
ca720fd
miri compiletest: no longer allow some warnings in rustc test suite
RalfJung Jun 3, 2023
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
21 changes: 10 additions & 11 deletions src/tools/miri/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ begingroup "Building Miri"
echo "Installing release version of Miri"
export RUSTFLAGS="-D warnings"
export CARGO_INCREMENTAL=0
./miri install # implicitly locked
export CARGO_EXTRA_FLAGS="--locked"
./miri install

# Prepare debug build for direct `./miri` invocations
echo "Building debug version of Miri"
export CARGO_EXTRA_FLAGS="--locked"
./miri check --no-default-features # make sure this can be built
./miri check --all-features # and this, too
./miri build --all-targets # the build that all the `./miri test` below will use
Expand All @@ -39,8 +39,11 @@ function run_tests {
## ui test suite
./miri test
if [ -z "${MIRI_TEST_TARGET+exists}" ]; then
# Only for host architecture: tests with optimizations (`-O` is what cargo passes, but crank MIR
# optimizations up all the way, too).
# Host-only tests: running these on all targets is unlikely to catch more problems and would
# cost a lot of CI time.

# Tests with optimizations (`-O` is what cargo passes, but crank MIR optimizations up all the
# way, too).
# Optimizations change diagnostics (mostly backtraces), so we don't check
# them. Also error locations change so we don't run the failing tests.
# We explicitly enable debug-assertions here, they are disabled by -O but we have tests
Expand All @@ -51,6 +54,9 @@ function run_tests {
for FILE in tests/many-seeds/*.rs; do
MIRI_SEEDS=64 CARGO_EXTRA_FLAGS="$CARGO_EXTRA_FLAGS -q" ./miri many-seeds ./miri run "$FILE"
done

# Check that the benchmarks build and run, but without actually benchmarking.
HYPERFINE="bash -c" ./miri bench
fi

## test-cargo-miri
Expand All @@ -75,13 +81,6 @@ function run_tests {
unset RUSTC MIRI
rm -rf .cargo

# Ensure that our benchmarks all work, but only on Linux hosts.
if [ -z "${MIRI_TEST_TARGET+exists}" ] && [ "$HOST_TARGET" = x86_64-unknown-linux-gnu ] ; then
for BENCH in $(ls "bench-cargo-miri"); do
cargo miri run --manifest-path bench-cargo-miri/$BENCH/Cargo.toml
done
fi

endgroup
}

Expand Down
11 changes: 6 additions & 5 deletions src/tools/miri/miri
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ if [ -z "$COMMAND" ]; then
fi
shift
# macOS does not have a useful readlink/realpath so we have to use Python instead...
MIRIDIR=$(python3 -c 'import os, sys; print(os.path.dirname(os.path.realpath(sys.argv[1])))' "$0")
MIRIDIR=$(python3 -c 'import pathlib, sys; print(pathlib.Path(sys.argv[1]).resolve().parent.as_posix())' "$0")
# Used for rustc syncs.
JOSH_FILTER=":rev(75dd959a3a40eb5b4574f8d2e23aa6efbeb33573:prefix=src/tools/miri):/src/tools/miri"
# Needed for `./miri bench`.
Expand Down Expand Up @@ -184,6 +184,8 @@ many-seeds)
exit 0
;;
bench)
# The hyperfine to use
HYPERFINE=${HYPERFINE:-hyperfine -w 1 -m 5 --shell=none}
# Make sure we have an up-to-date Miri installed
"$0" install
# Run the requested benchmarks
Expand All @@ -193,7 +195,7 @@ bench)
BENCHES=("$@")
fi
for BENCH in "${BENCHES[@]}"; do
hyperfine -w 1 -m 5 --shell=none "cargo +$TOOLCHAIN miri run --manifest-path $MIRIDIR/bench-cargo-miri/$BENCH/Cargo.toml"
$HYPERFINE "cargo +$TOOLCHAIN miri run --manifest-path $MIRIDIR/bench-cargo-miri/$BENCH/Cargo.toml"
done
exit 0
;;
Expand Down Expand Up @@ -280,10 +282,9 @@ find_sysroot() {
# Run command.
case "$COMMAND" in
install)
# "--locked" to respect the Cargo.lock file if it exists.
# Install binaries to the miri toolchain's sysroot so they do not interact with other toolchains.
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR" --force --locked --root "$SYSROOT" "$@"
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR"/cargo-miri --force --locked --root "$SYSROOT" "$@"
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR" --force --root "$SYSROOT" "$@"
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR"/cargo-miri --force --root "$SYSROOT" "$@"
;;
check)
# Check, and let caller control flags.
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8b4b20836b832e91aa605a2faf5e2a55190202c8
33c3d101280c8eb3cd8af421bfb56a8afcc3881d
7 changes: 4 additions & 3 deletions src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl HistoryData {
{
// NOTE: `transition_range` is explicitly absent from the error message, it has no significance
// to the user. The meaningful one is `access_range`.
self.events.push((Some(span.data()), format!("{this} then transitioned {transition} due to a {rel} {access_kind} at offsets {access_range:?}", rel = if is_foreign { "foreign" } else { "child" })));
self.events.push((Some(span.data()), format!("{this} later transitioned to {endpoint} due to a {rel} {access_kind} at offsets {access_range:?}", endpoint = transition.endpoint(), rel = if is_foreign { "foreign" } else { "child" })));
self.events.push((None, format!("this corresponds to {}", transition.summary())));
}
}
Expand Down Expand Up @@ -212,12 +212,13 @@ impl History {

/// Reconstruct the history relevant to `error_offset` by filtering
/// only events whose range contains the offset we are interested in.
fn extract_relevant(&self, error_offset: u64) -> Self {
fn extract_relevant(&self, error_offset: u64, error_kind: TransitionError) -> Self {
History {
events: self
.events
.iter()
.filter(|e| e.transition_range.contains(&error_offset))
.filter(|e| e.transition.is_relevant(error_kind))
.cloned()
.collect::<Vec<_>>(),
created: self.created,
Expand Down Expand Up @@ -303,7 +304,7 @@ impl TbError<'_> {
history.extend(self.accessed_info.history.forget(), "accessed", false);
}
history.extend(
self.conflicting_info.history.extract_relevant(self.error_offset),
self.conflicting_info.history.extract_relevant(self.error_offset, self.error_kind),
conflicting_tag_name,
true,
);
Expand Down
Loading