Auto merge of #3434 - RalfJung:stacked-borrows-cache-consistency, r=RalfJung
cotrol stacked borrows consistency check with its own feature flag Fixes https://github.com/rust-lang/miri/issues/3431
This commit is contained in:
commit
723acede10
3 changed files with 18 additions and 10 deletions
|
@ -59,6 +59,7 @@ harness = false
|
||||||
[features]
|
[features]
|
||||||
default = ["stack-cache"]
|
default = ["stack-cache"]
|
||||||
stack-cache = []
|
stack-cache = []
|
||||||
|
stack-cache-consistency-check = ["stack-cache"]
|
||||||
|
|
||||||
# Be aware that this file is inside a workspace when used via the
|
# Be aware that this file is inside a workspace when used via the
|
||||||
# submodule in the rustc repo. That means there are many cargo features
|
# submodule in the rustc repo. That means there are many cargo features
|
||||||
|
|
|
@ -22,17 +22,24 @@ if [ "$HOST_TARGET" = i686-pc-windows-msvc ]; then
|
||||||
BASH="C:/Program Files/Git/usr/bin/bash"
|
BASH="C:/Program Files/Git/usr/bin/bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Determine configuration for installed build
|
# Global configuration
|
||||||
echo "Installing release version of Miri"
|
|
||||||
export RUSTFLAGS="-D warnings"
|
export RUSTFLAGS="-D warnings"
|
||||||
export CARGO_INCREMENTAL=0
|
export CARGO_INCREMENTAL=0
|
||||||
export CARGO_EXTRA_FLAGS="--locked"
|
export CARGO_EXTRA_FLAGS="--locked"
|
||||||
|
|
||||||
|
# Determine configuration for installed build
|
||||||
|
echo "Installing release version of Miri"
|
||||||
./miri install
|
./miri install
|
||||||
|
|
||||||
# Prepare debug build for direct `./miri` invocations
|
echo "Checking various feature flag configurations"
|
||||||
echo "Building debug version of Miri"
|
|
||||||
./miri check --no-default-features # make sure this can be built
|
./miri check --no-default-features # make sure this can be built
|
||||||
./miri check --all-features # and this, too
|
./miri check # and this, too
|
||||||
|
# `--all-features` is used for the build below, so no extra check needed.
|
||||||
|
|
||||||
|
# Prepare debug build for direct `./miri` invocations.
|
||||||
|
# We enable all features to make sure the Stacked Borrows consistency check runs.
|
||||||
|
echo "Building debug version of Miri"
|
||||||
|
export CARGO_EXTRA_FLAGS="$CARGO_EXTRA_FLAGS --all-features"
|
||||||
./miri build --all-targets # the build that all the `./miri test` below will use
|
./miri build --all-targets # the build that all the `./miri test` below will use
|
||||||
|
|
||||||
endgroup
|
endgroup
|
||||||
|
|
|
@ -146,7 +146,7 @@ impl<'tcx> Stack {
|
||||||
/// Panics if any of the caching mechanisms have broken,
|
/// Panics if any of the caching mechanisms have broken,
|
||||||
/// - The StackCache indices don't refer to the parallel items,
|
/// - The StackCache indices don't refer to the parallel items,
|
||||||
/// - There are no Unique items outside of first_unique..last_unique
|
/// - There are no Unique items outside of first_unique..last_unique
|
||||||
#[cfg(all(feature = "stack-cache", debug_assertions))]
|
#[cfg(feature = "stack-cache-consistency-check")]
|
||||||
fn verify_cache_consistency(&self) {
|
fn verify_cache_consistency(&self) {
|
||||||
// Only a full cache needs to be valid. Also see the comments in find_granting_cache
|
// Only a full cache needs to be valid. Also see the comments in find_granting_cache
|
||||||
// and set_unknown_bottom.
|
// and set_unknown_bottom.
|
||||||
|
@ -190,7 +190,7 @@ impl<'tcx> Stack {
|
||||||
tag: ProvenanceExtra,
|
tag: ProvenanceExtra,
|
||||||
exposed_tags: &FxHashSet<BorTag>,
|
exposed_tags: &FxHashSet<BorTag>,
|
||||||
) -> Result<Option<usize>, ()> {
|
) -> Result<Option<usize>, ()> {
|
||||||
#[cfg(all(feature = "stack-cache", debug_assertions))]
|
#[cfg(feature = "stack-cache-consistency-check")]
|
||||||
self.verify_cache_consistency();
|
self.verify_cache_consistency();
|
||||||
|
|
||||||
let ProvenanceExtra::Concrete(tag) = tag else {
|
let ProvenanceExtra::Concrete(tag) = tag else {
|
||||||
|
@ -327,7 +327,7 @@ impl<'tcx> Stack {
|
||||||
// This primes the cache for the next access, which is almost always the just-added tag.
|
// This primes the cache for the next access, which is almost always the just-added tag.
|
||||||
self.cache.add(new_idx, new);
|
self.cache.add(new_idx, new);
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(feature = "stack-cache-consistency-check")]
|
||||||
self.verify_cache_consistency();
|
self.verify_cache_consistency();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ impl<'tcx> Stack {
|
||||||
self.unique_range.end = self.unique_range.end.min(disable_start);
|
self.unique_range.end = self.unique_range.end.min(disable_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "stack-cache", debug_assertions))]
|
#[cfg(feature = "stack-cache-consistency-check")]
|
||||||
self.verify_cache_consistency();
|
self.verify_cache_consistency();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -465,7 +465,7 @@ impl<'tcx> Stack {
|
||||||
self.unique_range = 0..0;
|
self.unique_range = 0..0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "stack-cache", debug_assertions))]
|
#[cfg(feature = "stack-cache-consistency-check")]
|
||||||
self.verify_cache_consistency();
|
self.verify_cache_consistency();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue