make cache consistency checks into regular debug assertions
This commit is contained in:
parent
efc76af134
commit
5d5999ab13
@ -54,8 +54,6 @@ harness = false
|
||||
|
||||
[features]
|
||||
default = ["stack-cache"]
|
||||
# Will be enabled on CI via `--all-features`.
|
||||
expensive-debug-assertions = []
|
||||
stack-cache = []
|
||||
|
||||
[profile.dev]
|
||||
|
4
ci.sh
4
ci.sh
@ -5,11 +5,11 @@ set -x
|
||||
# Determine configuration
|
||||
export RUSTFLAGS="-D warnings -C debug-assertions -C debuginfo=1"
|
||||
export CARGO_INCREMENTAL=0
|
||||
export CARGO_EXTRA_FLAGS="--all-features" # in particular, expensive-debug-assertions
|
||||
export CARGO_EXTRA_FLAGS="--all-features"
|
||||
|
||||
# Prepare
|
||||
echo "Build and install miri"
|
||||
CARGO_EXTRA_FLAGS="" ./miri install # implicitly locked -- and the *installed* Miri does *not* get the expensive-debug-assertions feature
|
||||
RUSTFLAGS="" ./miri install # implicitly locked, and explicitly without debug assertions
|
||||
./miri build --all-targets --locked # the build that all the `./miri test` below will use
|
||||
echo
|
||||
|
||||
|
@ -82,7 +82,7 @@ impl<'tcx> Stack {
|
||||
/// Panics if any of the caching mechanisms have broken,
|
||||
/// - The StackCache indices don't refer to the parallel items,
|
||||
/// - There are no Unique items outside of first_unique..last_unique
|
||||
#[cfg(feature = "expensive-debug-assertions")]
|
||||
#[cfg(debug_assertions)]
|
||||
fn verify_cache_consistency(&self) {
|
||||
// Only a full cache needs to be valid. Also see the comments in find_granting_cache
|
||||
// and set_unknown_bottom.
|
||||
@ -115,7 +115,7 @@ impl<'tcx> Stack {
|
||||
tag: SbTagExtra,
|
||||
exposed_tags: &FxHashSet<SbTag>,
|
||||
) -> Result<Option<usize>, ()> {
|
||||
#[cfg(feature = "expensive-debug-assertions")]
|
||||
#[cfg(debug_assertions)]
|
||||
self.verify_cache_consistency();
|
||||
|
||||
let SbTagExtra::Concrete(tag) = tag else {
|
||||
@ -247,7 +247,7 @@ impl<'tcx> Stack {
|
||||
// This primes the cache for the next access, which is almost always the just-added tag.
|
||||
self.cache.add(new_idx, new);
|
||||
|
||||
#[cfg(feature = "expensive-debug-assertions")]
|
||||
#[cfg(debug_assertions)]
|
||||
self.verify_cache_consistency();
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ impl<'tcx> Stack {
|
||||
self.unique_range.end = self.unique_range.end.min(disable_start + 1);
|
||||
}
|
||||
|
||||
#[cfg(feature = "expensive-debug-assertions")]
|
||||
#[cfg(debug_assertions)]
|
||||
self.verify_cache_consistency();
|
||||
|
||||
Ok(())
|
||||
@ -380,7 +380,7 @@ impl<'tcx> Stack {
|
||||
self.unique_range = 0..0;
|
||||
}
|
||||
|
||||
#[cfg(feature = "expensive-debug-assertions")]
|
||||
#[cfg(debug_assertions)]
|
||||
self.verify_cache_consistency();
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user