Commit Graph

3096 Commits

Author SHA1 Message Date
Ralf Jung
8497fd4906 pass clippy::integer_arithmetic in our shims 2022-08-22 10:11:16 -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
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
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
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
7c18b38e04 Rename memory hooks 2022-08-16 08:09:32 -04:00
Ralf Jung
79ebfa25dc make Miri build without the stack-cache feature 2022-08-15 18:35:11 -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
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
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
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
Ralf Jung
b99d7bc77f avoid intermediate allocations in show_error macro 2022-08-08 11:35:54 -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
b36b5e38b7 fix rustc lints in Miri 2022-08-07 10:17:02 -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
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
Ralf Jung
353f7d539a add special exception for std_miri_test crate to call std-only functions 2022-08-06 14:51:03 -04:00
Ralf Jung
79d147edb7 make home_dir work on macOS 2022-08-06 14:38:17 -04:00
Ralf Jung
f8449c2c78 stop excluding TERM env var on Unix 2022-08-06 14:31:26 -04:00
Ralf Jung
61be3bae40 support current_exe on macOS, and fix write_os_str length logic 2022-08-06 12:40:34 -04:00
bors
f633537f3e Auto merge of #2469 - RalfJung:math, r=RalfJung
implement some missing float functions

With this we support the entire float API surface of the standard library. :)

Also fixes https://github.com/rust-lang/miri/issues/2468 by using host floats to implement FMA.
2022-08-06 15:01:44 +00:00
Ralf Jung
b1316eca92 support and test some more math functions 2022-08-06 11:01:19 -04:00
Ralf Jung
5a4ac1ebf0 work around apfloat bug in FMA by using host floats instead 2022-08-06 11:01:19 -04:00
Ralf Jung
889c073aa6 really, clippy?!? 2022-08-06 09:03:33 -04:00
Ralf Jung
d61e55a1d4 add support for env::home_dir
and a bit of cleanup
2022-08-06 08:29:00 -04:00
bors
42087647d6 Auto merge of #2466 - RalfJung:longsleep, r=RalfJung
fix an ICE in nanosleep()
2022-08-06 00:52:42 +00:00
Ralf Jung
d7875ea530 fix an ICE in nanosleep() 2022-08-05 20:44:54 -04:00
Ralf Jung
6d14a5e2a7 avoid strerror_r failure on unknown errnum 2022-08-05 20:18:37 -04:00
Ralf Jung
e1e1f42f39 make errno table syntactically more similar to rustc library code 2022-08-03 11:51:39 -04:00
Christian Legnitto
9154f8b22c Add additional raw error mappings for the nightly io_error_more feature
Some crates are using nightly and failing when mapping these errors,
for example <https://miri.saethlin.dev/?crate=remove_dir_all&version=0.7.0>:

```
error: unsupported operation: io error NotADirectory cannot be translated into a raw os error
    --> /root/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/unix/fs.rs:1203:19
```
2022-08-03 11:23:15 -04:00
Christian Legnitto
b29e7b8e4e Add mkstemp shim for unix
Co-authored-by: Ralf Jung <post@ralfj.de>
2022-08-02 19:56:05 -04:00