Commit Graph

7003 Commits

Author SHA1 Message Date
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
Ralf Jung
a1f5a75c80 rustup 2022-08-09 13:59:43 -04:00
Ralf Jung
43d3963672 more detailed error message 2022-08-09 13:59:34 -04:00
Ralf Jung
927ab19cfc make some operations private to the data race detector / atomic intrinsic file 2022-08-09 13:59:34 -04:00
Ralf Jung
cd2edbfd09 ensure atomics happen on mutable allocations, and fix futex test 2022-08-09 13:59:34 -04:00
Ralf Jung
d630671a33 move atomic access alginment check to helper function and inside atomic access lib 2022-08-09 13:59:34 -04:00
bors
df3c141762 Auto merge of #2477 - RalfJung:show-error, r=RalfJung
don't make it quite so easy to get Miri to panic

Panicking on incorrect `-Zmiri` flags is a bit embarrassing, so let's finally fix that.
2022-08-08 15:37:01 +00:00
Ralf Jung
b99d7bc77f avoid intermediate allocations in show_error macro 2022-08-08 11:35:54 -04:00
Ralf Jung
1164815750 make cargo-miri show_error a bit nicer to use 2022-08-08 11:32:49 -04:00
Ralf Jung
12e3f75fd4 don't make it qutie so easy to get Miri to panic 2022-08-08 11:32:31 -04:00
bors
654e15b51c Auto merge of #2471 - RalfJung:term, r=RalfJung
stop excluding TERM env var on Unix

Effectively reverts https://github.com/rust-lang/miri/pull/2018.
Needs https://github.com/rust-lang/rust/pull/100206 to not be terribly slow.
Fixes https://github.com/rust-lang/miri/issues/2292.
2022-08-08 00:38:17 +00:00
Ralf Jung
5ead47e623 rustup 2022-08-07 20:36:57 -04:00
bors
94b6aaf267 Auto merge of #2476 - RalfJung:target-dir, r=RalfJung
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).
2022-08-07 15:54:32 +00:00
Ralf Jung
0f1ce43502 clarifying comments for target-dir handling 2022-08-07 11:53:25 -04:00
bors
5b22aa7873 Auto merge of #2475 - RalfJung:rustc-lints, r=RalfJung
enable rustc lints

Given how many rustc APIs we are using, this is probably a good idea.
Seems like we are lint-clean right now. :)
2022-08-07 14:17:21 +00:00
Ralf Jung
b36b5e38b7 fix rustc lints in Miri 2022-08-07 10:17:02 -04:00
Ralf Jung
366d11b2d8 enable rustc lints
(but not in cargo-miri and ui_test)
2022-08-07 09:45:42 -04:00
bors
a522442521 Auto merge of #2474 - RalfJung:cargo-metadata-args, r=RalfJung
also forward --manifest-path to 'cargo metadata'

and then I went on to refactor the argument flag splitting thing a bit, and, uh, that snowballed...
2022-08-07 02:49:33 +00:00
Ralf Jung
04744a2935 fix CI benchmark checks 2022-08-06 22:47:29 -04:00
Ralf Jung
08e7d94562 avoid some string copies... 2022-08-06 21:31:40 -04:00
Ralf Jung
465538245a reuse arg flag parse logic in rustdoc handling 2022-08-06 19:42:32 -04:00
Ralf Jung
e12df0f404 also forward --manifest-path to 'cargo metadata' 2022-08-06 19:42:32 -04:00
bors
aa53f3f77f Auto merge of #2472 - RalfJung:backtrace, r=RalfJung
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.
2022-08-06 19:30:50 +00:00
Ralf Jung
141d5a6396 avoid panic/panic folder 2022-08-06 15:30:00 -04:00
Ralf Jung
d2ba40e9e1 make tests pass again 2022-08-06 15:29:43 -04:00
Ralf Jung
76d99c37c9 fix RUSTC_BACKTRACE always being set 2022-08-06 15:21:08 -04:00