Commit Graph

6978 Commits

Author SHA1 Message Date
bors
09118da54f Auto merge of #2454 - saethlin:diagnostics-cleanup, r=RalfJung
Improve information sharing across SB diagnostics

Previous Stacked Borrows diagnostics were missing a lot of information about the state of the interpreter, and it was difficult to add additional state because it was threaded through all the intervening function signatures.

This change factors a lot of the arguments which used to be passed individually to many stacked borrows functions into a single `DiagnosticCx`, which is built in `Stacks::for_each`, and since it wraps a handle to `AllocHistory`, we can now handle more nuanced things like heterogeneous borrow of `!Freeze` types.
2022-08-18 20:37:50 +00:00
Ralf Jung
7397c8e9cf re-bless after rebase 2022-08-18 16:36:53 -04:00
Ben Kimock
15a4f0a9e0 some CurrentSpan cleanup 2022-08-18 16:36:53 -04:00
Ben Kimock
17fc52a06d Clean up diff churn a bit, adjust comments 2022-08-18 15:01:05 -04:00
Ben Kimock
14e72e7ffa Improve information sharing across SB diagnostics
Previous Stacked Borrows diagnostics were missing a lot of information
about the state of the interpreter, and it was difficult to add
additional state because it was threaded through all the intervening
function signatures.

This change factors a lot of the arguments which used to be passed
individually to many stacked borrows functions into a single
`DiagnosticCx`, which is built in `Stacks::for_each`, and since it
wraps a handle to `AllocHistory`, we can now handle more nuanced
things like heterogeneous borrow of `!Freeze` types.
2022-08-18 15:01:03 -04:00
bors
46da748502 Auto merge of #2231 - DrMeepster:winfred, r=RalfJung
Windows thread support: Part 1

This PR adds support for threads on Windows.
2022-08-18 15:26:07 +00:00
Ralf Jung
c466ac0b3e add some missing assert_target_os 2022-08-18 11:25:20 -04:00
bors
339500f060 Auto merge of #2493 - RalfJung:android, r=RalfJung
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.
2022-08-18 13:13:21 +00:00
Ralf Jung
5e10f14584 clippy... 2022-08-18 09:13:07 -04:00
Ralf Jung
4359f43e92 make abort-on-panic work on Android 2022-08-18 08:39:53 -04:00
Ralf Jung
3ec8dd8760 implement setting the thread name on freebsd 2022-08-18 08:34:16 -04:00
Ralf Jung
a05a8eb805 add very basic Android support 2022-08-18 08:34:16 -04:00
DrMeepster
d34242e8f1 fix various issues 2022-08-17 19:53:22 -07:00
DrMeepster
9f69c41c5f rewrite handle impl again 2022-08-17 19:53:22 -07:00
DrMeepster
08ffbb8d8a fix windows join/detach and add tests 2022-08-17 19:53:21 -07:00
DrMeepster
b6fc2fc82a basic theading 2022-08-17 19:53:21 -07:00
bors
af033ea428 Auto merge of #2492 - RalfJung:tests, r=RalfJung
organize shim tests into shims folder, and various test suite tweaks
2022-08-18 02:03:30 +00:00
Ralf Jung
ed41f1c969 remove some leftover //ignore that did not do anything 2022-08-17 22:02:20 -04:00
Ralf Jung
83953f58e7 remove unneeded rustc_private feature 2022-08-17 22:02:20 -04:00
Ralf Jung
7c856f8863 move libc pthread tests into separate file 2022-08-17 22:02:20 -04:00
Ralf Jung
38002b624a organize shim tests into shims folder 2022-08-17 21:50:23 -04:00
bors
b8f617897a Auto merge of #2491 - RalfJung:vscode, r=RalfJung
fix vscode configuration

Also now that we install rustfmt into the toolchain by default, we no longer need to adjust that command.
2022-08-17 11:46:14 +00:00
Ralf Jung
b4bdd5ca10 fix vscode configuration 2022-08-17 07:44:12 -04:00
bors
31b95dd749 Auto merge of #2485 - 5225225:memalign, r=RalfJung
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
2022-08-17 02:08:35 +00:00
bors
ac655ce7fe Auto merge of #2490 - RalfJung:ci, r=RalfJung
make sure all builds are locked on CI
2022-08-16 12:55:22 +00:00
Ralf Jung
ecb8ac5cf4 make sure all builds are locked on CI 2022-08-16 08:54:20 -04:00
bors
39c606fd58 Auto merge of #2488 - saethlin:rename-memory-hooks, r=RalfJung
Rename memory hooks

Companion to https://github.com/rust-lang/rust/pull/100600
2022-08-16 12:24:34 +00:00
Ben Kimock
3992f06728 rustup 2022-08-16 08:10:22 -04:00
Ben Kimock
7c18b38e04 Rename memory hooks 2022-08-16 08:09:32 -04:00
bors
793f198b9d Auto merge of #2489 - RalfJung:srw-merging, r=saethlin
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`
2022-08-16 11:54:55 +00:00
Ralf Jung
db43ee5714 defend test against overly smart Miri 2022-08-15 20:23:19 -04:00
Ralf Jung
2e3da5d8c3 check no-default-features and all-features build on CI 2022-08-15 19:33:07 -04:00
Ralf Jung
79ebfa25dc make Miri build without the stack-cache feature 2022-08-15 18:35:11 -04:00
Ralf Jung
297ddffff3 add test that we do not merge neighboring SRW 2022-08-15 18:32:14 -04:00
bors
a000764fb9 Auto merge of #2487 - RalfJung:rustup, r=RalfJung
rustup

Testing for nicer backtraces from https://github.com/rust-lang/rust/pull/100501.
2022-08-14 11:52:36 +00:00
Ralf Jung
e70473d944 rustup 2022-08-14 07:51:45 -04:00
bors
50ef22af52 Auto merge of #2484 - RalfJung:rustup, r=RalfJung
rustup; enable extra const UB checks
2022-08-13 13:04:16 +00:00
Ralf Jung
d59bad95fd fix data_race test 2022-08-13 09:03:30 -04:00
Ralf Jung
7df41a77b8 rustup 2022-08-13 08:23:28 -04:00
5225225
e75b2c8543 Breaking posix_memalign precondition is not UB 2022-08-13 13:20:56 +01:00
bors
4e1bc7e695 Auto merge of #2482 - RalfJung:raw-eq, r=RalfJung
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).
2022-08-12 15:26:53 +00:00
Ralf Jung
74e87b1dc5 add test for raw_eq on a pointer 2022-08-12 11:24:55 -04:00
bors
403b3f94bb Auto merge of #2480 - RalfJung:rustup, r=RalfJung
Rustup
2022-08-11 23:28:14 +00:00
Ralf Jung
96049ef88e move a bunch of type information into the respective shim 2022-08-11 19:27:24 -04:00
Ralf Jung
38a495346f remove prctl, now that std does not use it any more
it is a terrible variadic function...
2022-08-11 19:06:30 -04:00
Ralf Jung
23cd7b863f rustup for pthread_setname_np on Linux 2022-08-11 19:06:30 -04:00
bors
39ee574715 Auto merge of #2478 - RalfJung:rustup, r=RalfJung
rustup
2022-08-10 12:28:54 +00:00
bors
78cbda3bb2 Auto merge of #2461 - RalfJung:frame-in-std, r=RalfJung
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.
2022-08-10 12:03:51 +00:00
Ralf Jung
591274bbd9 rustup 2022-08-10 08:03:00 -04:00
bors
5aef34c016 Auto merge of #2464 - RalfJung:atomic-must-be-mutable, r=RalfJung
Atomics must be mutable

Fixes https://github.com/rust-lang/miri/issues/2463
Needs https://github.com/rust-lang/rust/pull/100181
2022-08-09 18:00:31 +00:00