add test that we do not merge neighboring SRW
Turns out that interior_mut2 also already tests this, but that also involves `UnsafeCell` so the new test still seems more clear. Basically the new test is the same as the old except that it uses raw pointers rather than `&UnsafeCell`. (When the old test was written, raw pointers were still untagged, so no such test would have been possible.)
I verified that both of these fail when we remove mutable references rather than disabling them.
Here is the patch I used for that:
<details>
```diff
diff --git a/Cargo.toml b/Cargo.toml
index 208b3a76..f9d1b0ac 100644
--- a/Cargo.toml
+++ b/Cargo.toml
`@@` -53,7 +53,7 `@@` name = "compiletest"
harness = false
[features]
-default = ["stack-cache"]
+default = []
stack-cache = []
# Be aware that this file is inside a workspace when used via the
diff --git a/src/lib.rs b/src/lib.rs
index ba337f28..2a3066f4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
`@@` -9,6 +9,7 `@@`
#![feature(is_some_with)]
#![feature(nonzero_ops)]
#![feature(local_key_cell_methods)]
+#![feature(drain_filter)]
// Configure clippy and other lints
#![allow(
clippy::collapsible_else_if,
diff --git a/src/stacked_borrows/stack.rs b/src/stacked_borrows/stack.rs
index 4a9a13d3..37246df7 100644
--- a/src/stacked_borrows/stack.rs
+++ b/src/stacked_borrows/stack.rs
`@@` -351,6 +351,9 `@@` impl<'tcx> Stack {
#[cfg(all(feature = "stack-cache", debug_assertions))]
self.verify_cache_consistency();
+ // HACK -- now just delete all disabled things.
+ self.borrows.drain_filter(|b| matches!(b.perm(), Permission::Disabled));
+
Ok(())
}
```
</details>
r? `@saethlin`
add test for raw_eq on a pointer
Let's make sure this keeps erroring; I have plans to refactor that part of the interpreter which will fix the error message (but could also lead to us accidentally accepting this which this test is there to avoid).
add special exception for std_miri_test crate to call std-only functions
These being the unit tests of std, they have their own copy of `std::sys` and `std::thread`, so the existing check says this is not std. The check is correct but we want to allow this so we just hard-code the crate name.
The point of this `frame_in_std` check is to prevent people from directly interacting with shims that aren't really properly implemented, but it doesn't need to be 100% airtight. If someone really wants to call their crate `std_miri_test` in order to access some broken shims... they can keep the pieces.
clarifying comments for target-dir handling
I thought we could simplify this logic, but alas, `cargo metadata --target-dir` is not a thing (even though the effective target-dir *does* affect the metadata).
fix RUSTC_BACKTRACE always being set
I kept wondering why Miri programs, whenever isolation is disabled, behave as if RUSTC_BACKTRACE was set. Finally I realized it's because some early rustc setup code sets that env var, and that is then propagated to the interpreted program.
So fix that by taking a copy of the environment before any rustc setup, and use that copy as the basis for what is provided to the interpreted program.