add very basic Android support
This is just enough to print to stdout. I won't push this any further, but having these basics should hopefully make it easier for others to do so.
Also slightly improve threading support on FreeBSD while we are at it.
Partially based on https://github.com/rust-lang/miri/pull/2011.
Fixes https://github.com/rust-lang/miri/issues/2010.
Breaking posix_memalign precondition is not UB
The `size==0` test here might be overtesting, but I figured might as well test it and leave a comment saying it is fine to remove it if the implementation changes.
Fixes#2099
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.