Commit Graph

2641 Commits

Author SHA1 Message Date
Gary Guo
c5b324b031
Remove likely and unlikely from intrinsics shim
They are now implemented in MIR interpreter by rust-lang/rust#73778
2020-07-02 20:00:27 +01:00
Ralf Jung
c379793cde add option to track call IDs 2020-07-02 10:33:54 +02:00
Ralf Jung
3a5bcb97ed move rwlock dequeuing to shared code, and use that code for Windows rwlocks 2020-06-28 11:28:46 +02:00
Ralf Jung
a9dc2796ca Move get/set_at_offset helpers to global helpers file 2020-06-28 09:23:01 +02:00
Ralf Jung
e54619b5e1 with this, we support panics on Windows 2020-06-27 14:43:37 +02:00
Ralf Jung
8e92969948 implement Windows SRWLock shims 2020-06-27 14:36:05 +02:00
Ralf Jung
dca00ab85e introduce platform-specific module hierarchy for dlsym (similar to foreign_items) 2020-06-27 14:36:05 +02:00
bors
bde2eb4a44 Auto merge of #1460 - RalfJung:modules, r=RalfJung
Re-organize platform-specific shims

Move platform-specific code to `shims::{posix::{linux, macos}, windows}`. Also make it private in these modules to ensure we are reasonably structured.
2020-06-27 11:27:36 +00:00
Ralf Jung
af5887e869 module organization: move platform-specific code to shims::{posix::{linux, macos}, windows} 2020-06-27 13:22:49 +02:00
Ralf Jung
395f5d40dc Rename shims::{sync -> posic_sync} and move sync_singlethread test to other sync test 2020-06-27 12:37:12 +02:00
Ralf Jung
b46f946c81 supply our own implementation of the CTFE pointer comparison intrinsics 2020-06-27 11:57:43 +02:00
Ralf Jung
5c5b61ffb0 rustup 2020-06-15 17:38:27 +02:00
Ralf Jung
e063ce2737 rustup; and a bit of UnsafeCell detection refactoring 2020-06-13 11:30:31 +02:00
bors
ffd03b3caa Auto merge of #1418 - divergentdave:file-sync, r=RalfJung
Add file sync shims

This PR adds shim implementations for these related file syncing functions.
* `fsync`, for POSIX targets, backed by `File::sync_all()`
* `fdatasync`, for POSIX targets, backed by `File::sync_data()`
* `fcntl` with command `F_FULLFSYNC`, for macOS targets, backed by `File::sync_all()`
* `sync_file_range`, for Linux targets, backed by `File::sync_data()`
2020-06-09 08:48:40 +00:00
David Cook
a60c130b0d Extract common logic for Windows host workaround 2020-06-08 23:34:02 +00:00
David Cook
e352d4fbb7 Finish fixing Windows host support 2020-06-06 16:54:13 +00:00
Ralf Jung
17dd44ee92 rustup 2020-06-01 19:23:54 +02:00
Ralf Jung
0b6ec575b9 make mutex_unlock infallible 2020-05-30 22:54:37 +02:00
Ralf Jung
acb3ec0866 test and fix for rwlock unlock bug 2020-05-30 22:48:43 +02:00
Ralf Jung
a80821e046 also combine re-locking into the dequeue-and-unblock operation 2020-05-30 22:35:58 +02:00
Ralf Jung
7589bc7ba9 sync cleanup: mark infallible ops as such; consistent combine en/dequeue with (un)block; comments 2020-05-30 22:29:27 +02:00
Ralf Jung
c77e9022d5 rustup (and account for stabilization) 2020-05-30 09:23:25 +02:00
Joe Richey
394a57fc22 Remove pointer arithmetic intrinsics
These are now implemented in rustc's mir interpreter

Signed-off-by: Joe Richey <joerichey@google.com>
2020-05-30 09:06:37 +02:00
Ralf Jung
f55c0153f1 str_strip is stable 2020-05-29 10:01:07 +02:00
bors
83b4222d9a Auto merge of #1422 - RalfJung:cargo-miri-workspace, r=oli-obk
Move cargo-miri into separate package

So far, `cargo-miri` depended on the Miri library crate. That was mostly for convenience (to avoid having to deal with workspaces), but also because until recently `cargo-miri` needed access to the ["Miri default flags"](af044209b0/src/lib.rs (L75)). But with `MIRI_BE_RUSTC` that is no longer the case, so we can remove this fake dependency. :)

@oli-obk what do you think? Also I expect the rustc bootstrap integration will need updates, hints would be appreciated. :D
2020-05-28 13:02:41 +00:00
Ralf Jung
0790f75ae4 make cargo-miri a separate crate in a workspace 2020-05-28 08:53:44 +02:00
Ralf Jung
60f466d6ad use strip_prefix where it makes sense 2020-05-28 08:51:38 +02:00
David Cook
c01bc14219 Fix fsync shim for Windows hosts with RO files 2020-05-25 21:45:29 -05:00
David Cook
7ba8bbc49f Update comments 2020-05-25 07:32:56 -05:00
Ralf Jung
a95f754a9c better error when reading from stdin 2020-05-25 10:39:43 +02:00
Ralf Jung
9ff77f6cb3 add an assertion 2020-05-25 09:59:01 +02:00
Ralf Jung
1fecbd8a87 macos does not have pthread_condattr_setclock/getclock 2020-05-25 09:42:08 +02:00
Vytautas Astrauskas
dec205757a Fix compilation errors after rebase. 2020-05-25 00:28:01 +02:00
Vytautas Astrauskas
90590a399d Small fixes. 2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
6ff0af3adf Fix #1419. 2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
bd97074517 Small changes. 2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
8b5a9836be Small changes. 2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
0838347d8f Change the scheduling to execute timeout callbacks first. 2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
fdfd56b75b Small changes. 2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
3da61fa427 Add comments explaining the declare_id macro. 2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
0bbac12751 Change how the time is handled. 2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
86eb262e8a Cleanup Condvar tests. 2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
044a068c67 Improve code readability and comments. 2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
d0de439ac8 Cleanup. 2020-05-25 00:02:54 +02:00
Vytautas Astrauskas
679245769b Implement support for synchronization primitives. 2020-05-25 00:02:54 +02:00
Ralf Jung
2c94ad08d8 use helper method to compute size of int type 2020-05-24 19:20:44 +02:00
Ralf Jung
cf7d88fd91 unset RUSTC_WRAPPER for xargo invocation 2020-05-24 14:46:38 +02:00
David Cook
87a846f2d6 Update to match rustc changes 2020-05-22 17:03:25 +02:00
Ralf Jung
fbb8c1526a verify the size of all shim arguments 2020-05-22 11:56:18 +02:00
Ralf Jung
402535ef86 also pretend GetSystemTimePreciseAsFileTime does not exist 2020-05-21 23:24:37 +02:00
Ralf Jung
526fae7541 GetProcAddress: basic validation for hModule argument 2020-05-21 23:06:31 +02:00
Ralf Jung
f09decb398 disentangle macos and linux dlsyms 2020-05-21 23:01:27 +02:00
Ralf Jung
08ddbd6ce0 prepare Dlsym system for dynamic symbols on Windows 2020-05-21 22:38:06 +02:00
David Cook
0b060c7364 Review comments 2020-05-19 08:57:31 -05:00
David Cook
87c4694448 Add file sync shims
Adds implementations for fsync, fdatasync, and sync_file_range
2020-05-17 22:10:40 -05:00
Ralf Jung
d90a087df9 fix libstd rebuilds due to RUSTFLAGS changes 2020-05-17 11:20:05 +02:00
Ralf Jung
e22baedb1f add test suite filter example to README and 'cargo miri --help' 2020-05-17 10:12:17 +02:00
Ralf Jung
e0f9081c5c use new rustc_driver::catch_with_exit_code 2020-05-16 11:30:11 +02:00
Ralf Jung
4a2e08f9b8 fix warnings for non-Unix builds 2020-05-11 10:58:27 +02:00
Ralf Jung
938fe00f02 fix some comments, and run_compiler return type 2020-05-11 00:09:46 +02:00
Ralf Jung
845b89c236 we do not need to set RUSTFLAGS for xargo any more as miri-as-rustc already uses these flags 2020-05-10 18:56:38 +02:00
Ralf Jung
81046fa5e5 cargo-miri: never invoke rustc, always go through 'MIRI_BE_RUSTC=1 miri' instead 2020-05-10 18:41:03 +02:00
Oliver Scherer
3fdab9c446 Update to rustc changes 2020-05-10 10:14:03 +02:00
Ralf Jung
ac65350789 adjust default sysroot when being rustc
Also while at it, refactor how we pass the default Miri flags
2020-05-09 13:42:07 +02:00
Ralf Jung
ba801a45db make Miri work in rustc bootstrap stage 0 2020-05-09 13:19:23 +02:00
Ralf Jung
024cc435f4 avoid env::var which requires valid UTF-8 2020-05-09 12:04:21 +02:00
Ralf Jung
20097be2fe more comment 2020-05-09 11:54:45 +02:00
Ralf Jung
1ba42b9f55
Wording
Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-05-09 11:53:24 +02:00
Ralf Jung
e73fc97f0b cargo-miri: honor RUSTC env var 2020-05-09 11:52:26 +02:00
Ralf Jung
70f83a342c re-do cargo-miri host/target detection logic to match rustbuild 2020-05-09 11:45:43 +02:00
Ralf Jung
379ac82a1c bump Rust, fix for renames 2020-05-09 10:15:09 +02:00
Ralf Jung
914e483c89 fix cargo-miri intercepting --help/--version arguments 2020-05-08 09:55:28 +02:00
Ralf Jung
45ef97535f fs shim: check that mode is default 2020-05-05 16:49:01 +02:00
Ralf Jung
40800cfa19 make sure we check the size of all arguments 2020-05-05 12:19:54 +02:00
Ralf Jung
5656cb73d4 fix a comment now that we have concurrency 2020-05-05 11:59:22 +02:00
Ralf Jung
cd6be98852 make sure we check argument count everywhere 2020-05-05 11:59:22 +02:00
Ralf Jung
5566e3901c deduplicate FD extraction 2020-05-05 11:44:33 +02:00
Chase Albert
4e3d1fee51 Address comments. 2020-05-04 14:24:22 -04:00
Chase Albert
4d3dff2add Address consistency of naming for unused/merely validated arguments. 2020-05-04 13:51:23 -04:00
Chase Albert
78f329513a Check that shims are called with the correct number of arguments 2020-05-04 13:51:21 -04:00
Ralf Jung
61a86e1ffe Windows lock primitives: check that we are truly sinle-threaded 2020-05-04 09:37:40 +02:00
Ralf Jung
6b18f6e106 fix setting thread name on macOS 2020-05-03 13:22:56 +02:00
Ralf Jung
6680118588 de-duplicate <unnamed> default thread name 2020-05-03 12:56:38 +02:00
Ralf Jung
994b13eaee yield on x86 'pause' hint 2020-05-03 12:43:38 +02:00
Ralf Jung
1578540959 bump Rust, fix warnings 2020-05-03 12:10:24 +02:00
Ralf Jung
393165f859 rustup; fix for changed error messages 2020-05-01 14:43:59 +02:00
Ralf Jung
ba670d6970 make sure macos function has 'macos' in its name 2020-04-30 19:38:17 +02:00
bors
351d46d3fb Auto merge of #1284 - vakaras:add-threads-cr2, r=RalfJung
Implement basic support for concurrency (Linux/macos only)

Changes  (most new code is in `src/threads.rs` and `src/shims/foreign_items/posix.rs`):

1. Move the stack from `Machine` to a newly created `Thread` struct.
2. Add a `ThreadSet` struct that manages the threads.
3. Change `canonical_alloc_id` to create a unique allocation id for each thread local and thread (the responsible struct is `ThreadLocalStorage`)
4. Change the code to execute the thread local destructors immediately when a thread terminates.
5. Add the most basic round-robin scheduler.

This pull request depends on [these changes to the compiler](https://github.com/rust-lang/rust/pull/70598).
2020-04-30 16:21:43 +00:00
Vytautas Astrauskas
48da0cf489 Fix prctl SET_NAME and GET_NAME behaviour. 2020-04-30 08:35:59 -07:00
Ralf Jung
e9212d14ac more helpful error on workspaces 2020-04-30 10:19:34 +02:00
Vytautas Astrauskas
603ec0b3d8 Fix a regression in Windows dtors. 2020-04-29 15:20:26 -07:00
Vytautas Astrauskas
0e052ab897 Use Entry API in set_dtors_running. 2020-04-29 15:12:09 -07:00
Vytautas Astrauskas
46b03174d0 Improve code readability and comments. 2020-04-29 13:16:22 -07:00
Ralf Jung
a5445e0230 rustup for more LocalDefId changes 2020-04-28 10:30:21 +02:00
Vytautas Astrauskas
3b5854191c Fix MacOS and Windows builds. 2020-04-27 15:21:01 -07:00
Vytautas Astrauskas
1355574beb Delete remaining tls entries after all destructors completed. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
df2ca53b69 Make From implementations non-failing. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
c56ef31780 Improve comments. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
f204b67b0f Merge dtors_running and last_dtor_key fields. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
356aecce7f Add a FIXME. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
207c6e7fa7 Improve comments and code clarity. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
9ba3ef2a44 Change representation and conversion of ThreadId and BlockSetId. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
174adad2b3 Use DLL_THREAD_DETACH when calling windows TLS destructor. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
d9e18ada39 Make sure to remove thread local data only if we have destructor. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
911ff7eade Improve style and comments. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
c4574dde8d Many small changes to clean up code. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
6842eb2b84 Rename global tls dtor to thread dtor. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
64164b10e8 Improve comments. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
bc9d007e3e Improve Debug formatting of the thread name. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
04abf066f1 Move copying of the thread name to the client side. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
feb188360e Unify TLS dtors; move stepping outside. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
d45e985669 Clarify FIXME. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
8a7dbde372 Check prctl argument types and fix the test. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
e7c2694b8b Make the main thread detached. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
69eaaadc28 Fix merge error. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
452e36efb3 Print the thread name in Debug. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
3bb1657448 Small style fix. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
9a01c3fa3e Clarify comments about TLS destructor handling in Windows, add a test for TLS destructors. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
e4dc3567f8 Track if a thread was already joined. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
17f7bc86ae Fix how a pthread_create function argument is constructed. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
94cbe88e80 Many small changes to thread management. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
75e6549c11 Improve prctl, add a test. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
eab38dfe00 Change the warning message. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
69df2e19de Move prctl to Linux specific shims. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
d6c03926ab Rename MacOS set global dtor function. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
421be273cc Add concurrency tests. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
46fd333daa Implement thread::yield_now. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
134533d066 Add a comment explaining global destructors on MacOS. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
d062f63519 Fix support for MacOS. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
44e9305599 Rename threads to thread to match the Rust standard library. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
a585dc8289 Add a missing newline. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
688cacbdd7 Cleanup the implementation of adjust_global_const. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
1d0eb93ebd Fix typo in a comment. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
94118d4d9a Make an assert message consistent with other asserts. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
552080a5b7 Fix imports. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
4609c3c520 Rename eval_maybe_thread_local_static_const to adjust_global_const. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
325c31e578 Address some of the reviewers comments. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
51b16e56cd Generate thread local allocations in eval_maybe_thread_local_static_const. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
963e9698f9 Generate fresh allocation ids for thread locals in eval_maybe_thread_local_static_const. 2020-04-27 14:26:36 -07:00
Vytautas Astrauskas
0c4303cd7f Small refactoring in pthread sync: extract common functionallity to separate functions. 2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
d907fb5021 Rename ThreadSet to ThreadManager. 2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
1c8a59c691 Rebase on PR 1157. 2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
2202278f6a Fix pthread_self. 2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
f21197f081 Store the thread name. 2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
52184193c3 Fix comments in TLS. 2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
ed9c7d168b Report that we do not support foreign thread local statics. 2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
1f33f04fd4 Move pthread_create and related shims to a separate file. 2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
aef4c95599 Fix the problem of sending pointed to thread local statics. Add a regression test. 2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
8dd8f199ca Update to support the updated API. 2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
58a6a2729a Add a warning that Miri does not check for data-races. 2020-04-27 14:23:32 -07:00
Vytautas Astrauskas
82f17ab917 Implement basic support for concurrency (Linux only). 2020-04-27 14:23:32 -07:00
bors
da940eb91f Auto merge of #1354 - divergentdave:dump-alloc-on-undef-read, r=RalfJung
Print hex dump of alloc on reading undef bytes

Here's a small addition I made locally to the UB diagnostics, in case you're interested in it. This PR calls `dump_alloc()` on the relevant allocation if Miri fails on UB due to reading undefined bytes. This came in handy when diagnosing such an issue in a large program using unsafe Rust, in part because it wasn't deterministic enough to use `-Zmiri-track-alloc-id=`. If you'd like to put this behind another -Z flag, let me know.
2020-04-27 09:33:30 +00:00
David Cook
e267fb4ede Review comments 2020-04-26 22:13:36 -05:00
Ralf Jung
b128879529 make sure we do not discard information on the Ok exit side 2020-04-25 11:16:03 +02:00
Ralf Jung
c46668c556 fix exit code on rustc errors 2020-04-25 11:12:50 +02:00
David Cook
d9ac84d05f Add message before dumping alloc 2020-04-23 20:00:09 -05:00
David Tolnay
a4dd463eaf
Keep MiriCommand out of ask_to_run function 2020-04-23 10:27:38 -07:00
David Tolnay
2584507ce2
Preserve consistent output whether or not CI is set 2020-04-23 10:12:48 -07:00
David Tolnay
60fa9acdf7
Disable interactive prompts in CI 2020-04-23 08:51:12 -07:00
David Cook
9057dae235 Reorder output 2020-04-22 17:44:12 -05:00
bors
26baf87e43 Auto merge of #1348 - RalfJung:raw-addr-of-align, r=RalfJung
Stacked Borrows: alignment does not matter

Fixes https://github.com/rust-lang/miri/issues/1339
Requires https://github.com/rust-lang/rust/pull/71280
2020-04-22 21:44:14 +00:00
Ralf Jung
4b9abdaa50 rustup 2020-04-22 23:43:54 +02:00
Ralf Jung
270adbc7c6 Stacked Borrows: alignment does not matter 2020-04-22 23:32:19 +02:00
David Cook
f49839ac30 Add comment 2020-04-22 07:09:20 -05:00
David Cook
e37d0e3125 Print hex dump of alloc on reading undef bytes 2020-04-21 21:28:22 -05:00
David Cook
54897f66f8 Implement ftruncate64/ftruncate for File::set_len 2020-04-21 21:17:54 -05:00
bors
8d9db57a0d Auto merge of #1335 - vakaras:add-threads-noop, r=RalfJung
Move the stack to the evaluator. (no-op PR for 70598)

The changes to Miri to make it to compile with Rustc PR https://github.com/rust-lang/rust/pull/70598.
2020-04-20 08:39:29 +00:00
Vytautas Astrauskas
192fd3d97e Move stack and stack_mut implementation in Machine to match their position in the trait. 2020-04-20 09:19:37 +02:00
Vytautas Astrauskas
5224c72403 Move the stack to the evaluator to make Miri compile with the newest Rustc. 2020-04-20 09:19:37 +02:00
bors
763782aa08 Auto merge of #1342 - divergentdave:pause-instruction, r=RalfJung
Handle std::sync::atomic::spin_loop_hint()

This PR adds support for `std::sync::atomic::spin_loop_hint()` by implementing the `llvm.x86.sse2.pause` intrinsic when the target is x86-based. It appears this is the first LLVM intrinsic in foreign_items, so I added a couple match blocks to handle it or fall through to the different OS-specific methods. I added a basic smoke test to `tests/run-pass/sync.rs`. I came across this by way of `crossbeam::utils::Backoff::spin()`, FWIW.
2020-04-19 14:53:02 +00:00
David Cook
547a4cc920 Review comments 2020-04-19 09:22:40 -05:00
David Cook
7b69a6271e Add support for std:🧵:yield_now 2020-04-18 19:31:02 -05:00
David Cook
11cd87e457 Flip matching 2020-04-18 19:16:52 -05:00
Ralf Jung
14f50b34a3 use pre-computed layouts some more 2020-04-18 17:54:26 +02:00
bors
45113eb6a4 Auto merge of #1325 - RalfJung:float_to_int_unchecked, r=RalfJung
implement float_to_int_unchecked

@hanna-kruppe would be great if you could have a look at this.

`float.rs` tests legal casts. `test_cast` checks that both `as` casts and unchecked casts work (i.e., these are not saturating). The `compile-fail` tests should ensure that illegal casts via the intrinsic are detected as such.

Fixes https://github.com/rust-lang/miri/issues/1264
2020-04-18 08:13:24 +00:00
Ralf Jung
6ad0187265 rustup for FieldsShape::Primitive 2020-04-17 14:19:26 +02:00
David Cook
57c7119315 Handle std::sync::atomic::spin_loop_hint() 2020-04-16 23:24:57 -05:00
Ralf Jung
ff3b382b14 ReadBytesAsPointer is always supported 2020-04-16 18:36:03 +02:00
bors
5c823a1ec1 Auto merge of #1337 - RalfJung:intrinsic-tests, r=RalfJung
test some so-far untested intrinsics
2020-04-15 16:09:40 +00:00
Ralf Jung
07c696e27e test some so-far untested intrinsics 2020-04-15 18:00:16 +02:00
Ozaren
b77968e8bd
added deallocation tracking 2020-04-15 11:29:35 -04:00
Ralf Jung
0805b4bf2e retag return places 2020-04-15 12:39:19 +02:00
Ralf Jung
90d71cd13f adjust for frame hook changes 2020-04-15 12:33:52 +02:00
bors
669191bca9 Auto merge of #1331 - samrat:macos-mach-timebase-info, r=RalfJung
Implement `mach_timebase_info` for macOS

Since we return nanoseceonds instead of ticks from `mach_absolute_time`, we don't need to scale the absolute time

Fixes #1288
2020-04-14 09:30:22 +00:00
Samrat Man Singh
fff45b77ad
Reword comment in mach_timebase_info
Co-Authored-By: Ralf Jung <post@ralfj.de>
2020-04-14 13:59:43 +05:30
Samrat Man Singh
90729bb039 Use precomputed TyLayout from machine.layouts
And add comment documenting successful return value from
`mach_timebase_info`.
2020-04-14 13:31:24 +05:30
Samrat Man Singh
f6bb8111f2 Use pre-defined u32 layout
Also fix typo and remove newline
2020-04-14 09:40:40 +05:30
Ralf Jung
0ad1114153 mention new option in README and diagnostics 2020-04-13 17:58:03 +02:00
Ralf Jung
fd8beaf5c4 add option to disable alignment checks 2020-04-13 17:58:03 +02:00
Samrat Man Singh
5f6d250b30 [macOS] Implement mach_timebase_info
Since we return nanoseceonds instead of ticks from
`mach_absolute_time`, we don't need to scale the absolute time
2020-04-13 21:18:34 +05:30
Ralf Jung
75297d3536 for alignment errors, note that there might be false positives 2020-04-13 09:18:11 +02:00
Ralf Jung
91d7964513 rustup 2020-04-13 00:44:29 +02:00
Ralf Jung
a82efce590 remove some unnecessary trait bounds 2020-04-12 22:01:46 +02:00
Ralf Jung
78ce616490 implement float_to_int_unchecked 2020-04-12 12:01:20 +02:00
Ralf Jung
2a3ce5d618 there is no 'align_of_val' intrinsic 2020-04-12 11:04:18 +02:00
Ralf Jung
fd0957f5cd remove an intrinsic that was moved to rustc 2020-04-12 11:02:56 +02:00
Ralf Jung
6414003ab9 organize intrinsics into groups 2020-04-12 11:01:59 +02:00
Ralf Jung
314e7238cf avoid a bunch of as_ref/as_mut 2020-04-12 10:32:36 +02:00
Ralf Jung
97791a56da avoid ref in matches 2020-04-12 10:08:12 +02:00
bors
2e82a8dc9e Auto merge of #1304 - RalfJung:backtrace-sep, r=RalfJung
add empty line before backtrace, to separate it from help text

I think this improves how things look, and makes it easier to see the help text (it currently kind of drowns next to the backtrace).

Before:
```
error: unsupported operation: Miri does not support threading
  --> /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys/unix/thread.rs:68:19
   |
68 |         let ret = libc::pthread_create(&mut native, &attr, thread_start, &*p as *const _ as *mut _);
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Miri does not support threading
   |
   = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
   = note: inside `std::sys::unix:🧵:Thread::new` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys/unix/thread.rs:68:19
   = note: inside `std:🧵:Builder::spawn_unchecked::<[closure@tests/compile-fail/thread-spawn.rs:6:19: 6:24], ()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/thread/mod.rs:492:26
   = note: inside `std:🧵:Builder::spawn::<[closure@tests/compile-fail/thread-spawn.rs:6:19: 6:24], ()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/thread/mod.rs:386:18
   = note: inside `std:🧵:spawn::<[closure@tests/compile-fail/thread-spawn.rs:6:19: 6:24], ()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/thread/mod.rs:619:5
note: inside `main` at tests/compile-fail/thread-spawn.rs:6:5
  --> tests/compile-fail/thread-spawn.rs:6:5
   |
6  |     thread::spawn(|| {});
   |     ^^^^^^^^^^^^^^^^^^^^
   = note: inside closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:34
   = note: inside closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:73
   = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1:6030 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys_common/backtrace.rs:130:5
   = note: inside closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:13
   = note: inside `std::panicking::try::do_call::<[closure@DefId(1:6029 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/panicking.rs:331:40
   = note: inside `std::panicking::try::<i32, [closure@DefId(1:6029 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe]>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/panicking.rs:274:15
   = note: inside `std::panic::catch_unwind::<[closure@DefId(1:6029 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/panic.rs:394:14
   = note: inside `std::rt::lang_start_internal` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:51:25
   = note: inside `std::rt::lang_start::<()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:5
```
After:
```
error: unsupported operation: Miri does not support threading
  --> /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys/unix/thread.rs:68:19
   |
68 |         let ret = libc::pthread_create(&mut native, &attr, thread_start, &*p as *const _ as *mut _);
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Miri does not support threading
   |
   = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support

   = note: inside `std::sys::unix:🧵:Thread::new` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys/unix/thread.rs:68:19
   = note: inside `std:🧵:Builder::spawn_unchecked::<[closure@tests/compile-fail/thread-spawn.rs:6:19: 6:24], ()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/thread/mod.rs:492:26
   = note: inside `std:🧵:Builder::spawn::<[closure@tests/compile-fail/thread-spawn.rs:6:19: 6:24], ()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/thread/mod.rs:386:18
   = note: inside `std:🧵:spawn::<[closure@tests/compile-fail/thread-spawn.rs:6:19: 6:24], ()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/thread/mod.rs:619:5
note: inside `main` at tests/compile-fail/thread-spawn.rs:6:5
  --> tests/compile-fail/thread-spawn.rs:6:5
   |
6  |     thread::spawn(|| {});
   |     ^^^^^^^^^^^^^^^^^^^^
   = note: inside closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:34
   = note: inside closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:73
   = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1:6030 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys_common/backtrace.rs:130:5
   = note: inside closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:13
   = note: inside `std::panicking::try::do_call::<[closure@DefId(1:6029 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/panicking.rs:331:40
   = note: inside `std::panicking::try::<i32, [closure@DefId(1:6029 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe]>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/panicking.rs:274:15
   = note: inside `std::panic::catch_unwind::<[closure@DefId(1:6029 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/panic.rs:394:14
   = note: inside `std::rt::lang_start_internal` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:51:25
   = note: inside `std::rt::lang_start::<()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:5
```

What do you think?
2020-04-10 09:29:35 +00:00
bors
325682ad56 Auto merge of #1301 - RalfJung:global-leaks, r=RalfJung
memory reachable through globals is not a leak

Blocked on https://github.com/rust-lang/rust/pull/70762
Fixes https://github.com/rust-lang/miri/issues/940
2020-04-07 17:33:24 +00:00
Ralf Jung
f462b4c257 memory reachable through globals is not a leak any more; adjust for better memory dumping 2020-04-07 19:03:41 +02:00
bors
d935f62172 Auto merge of #1157 - divergentdave:shim-pthread-try-lock, r=RalfJung
Add shims for RwLock::try_read/RwLock::try_write

This implements proper locking so that we can check for reentrancy and implement the `try_*` methods.

Fixes https://github.com/rust-lang/miri/issues/781
2020-04-06 13:55:53 +00:00
David Cook
0f5f0e1520 Fix spelling typo 2020-04-05 20:55:39 -05:00
David Cook
bc54c7628d Eagerly compute i32 and u32 layouts 2020-04-05 16:03:44 -05:00
David Cook
f9dc942cfd Changes to error handling 2020-04-05 13:53:03 -05:00
David Cook
e7944419d4 Use Deadlock machine stop uniformly 2020-04-05 12:44:23 -05:00
David Cook
100141f57c Remove null checks, fall through to UB upon deref 2020-04-05 12:32:09 -05:00
David Cook
79f3307f30 Update comments, rearrange code 2020-04-05 12:09:31 -05:00
David Cook
ac8c98da8e Store layouts of i32 and u32 inside Evaluator 2020-04-05 10:37:57 -05:00
David Cook
8293d80b53 Set explicit return value size for windows shim 2020-04-05 10:36:14 -05:00
David Cook
e1a1592991 Set some explicit return value sizes 2020-04-05 10:35:08 -05:00
David Cook
37ddde9f70 Implement TryEnterCriticalSection 2020-04-05 10:33:32 -05:00
David Cook
7f6df15aa2 Rearrange functions 2020-04-05 10:32:06 -05:00
David Cook
c7466c9531 Add TerminationInfo::Deadlock, use in mutex shim 2020-04-05 10:32:01 -05:00
David Cook
735fc12e1a Handle variation in layout of pthread_mutex_t 2020-04-05 10:27:31 -05:00
David Cook
e5e3256b59 Address review comments 2020-04-05 10:10:35 -05:00
David Cook
ba3884dae6 Use checked addition/subtraction on lock counts 2020-04-05 10:08:39 -05:00
David Cook
141319a412 Refactor sync shims with setters and getters 2020-04-05 10:07:39 -05:00
David Cook
fd94255b9d Add comments explaining asserts 2020-04-05 10:06:37 -05:00
David Cook
d11315ebfb Fix misleading function names 2020-04-05 10:05:34 -05:00
David Cook
765050f302 Revise mutex/rwlock memory layout for macOS compat 2020-04-05 10:03:29 -05:00
David Cook
dd9896b0f8 Implement mutex and rwlock functions 2020-04-05 10:03:22 -05:00
David Cook
88f319fb4c Add failing tests for mutex and rwlock 2020-04-05 09:25:21 -05:00
David Cook
46679bc9ef Add shims for RwLock::try_read/RwLock::try_write 2020-04-05 09:25:21 -05:00
Stein Somers
e7fafa1904 Replace last_entry with last_key_value 2020-04-05 15:21:15 +02:00
Ralf Jung
95ea03c124 add empty line before backtrace, to separate it from help text 2020-04-05 10:20:12 +02:00
Ralf Jung
0eccf1d9aa update Windows leak comment 2020-04-05 09:42:39 +02:00
bors
26d7e9bd23 Auto merge of #1300 - RalfJung:rust-src, r=RalfJung
Rust bootstrap sysroot now has src in the same place as rust-src

So we can remove a special hack. I checked this locally to confirm it works.

Cc https://github.com/rust-lang/rust/pull/70642 @eddyb
2020-04-04 14:46:40 +00:00
Ralf Jung
bd9ec746a5 Rust bootstrap sysroot now has src in the same place as rust-src, so remove special hack 2020-04-04 12:07:22 +02:00
bors
0e8a1a40f2 Auto merge of #1294 - JOE1994:windows_instant, r=RalfJung
Add support for 'std::time::Instant' in Windows

Add support for creating `std::time::Instant` in Windows

Includes shims for `QueryPerformanceCounter` & `QueryPerformanceFrequency` in Windows, which are both called in Windows when `std::time::Instant` is created.

Windows docs page ["Acquiring high-resolution time stamps"](https://docs.microsoft.com/en-us/windows/win32/sysinfo/acquiring-high-resolution-time-stamps) was helpful in learning how `QueryPerformanceCounter` & `QueryPerformanceFrequency` work.

closes #1291
2020-04-03 06:36:15 +00:00
Ralf Jung
9f3383d55d rustup for import changes 2020-04-03 00:05:35 +02:00
Youngsuk Kim
f762c70b51
Update comments in src/shims/time.rs
Co-Authored-By: Ralf Jung <post@ralfj.de>
2020-04-02 16:04:50 -04:00
Youngsuk Kim
5157b8769f
Update comments in src/shims/time.rs
Co-Authored-By: Ralf Jung <post@ralfj.de>
2020-04-02 16:04:10 -04:00
Youngsuk Kim
a494825d5a
Update comments in src/shims/time.rs
Co-Authored-By: Ralf Jung <post@ralfj.de>
2020-04-02 16:03:56 -04:00
Ralf Jung
d5beecb79c correct factual mistake in Windows message, and use "+" sugar 2020-04-02 15:16:20 +02:00
Ralf Jung
5ce2466892 fix for FieldPlacement rename 2020-04-02 09:19:56 +02:00
Ralf Jung
f599687f3f adjust for span not being passed around any more 2020-04-02 09:14:17 +02:00
Ralf Jung
5130aa55a2 adjust stacktrace printing to rustc changes 2020-04-02 09:14:17 +02:00
JOE1994
ff982b1821 fix incorrect error message in shim 'QueryPerformanceCounter' 2020-04-01 21:26:47 -04:00
JOE1994
957ec2be10 Add support for 'std::time::Instant' in Windows 2020-04-01 20:35:56 -04:00
bors
6536f3165e Auto merge of #1290 - RalfJung:rustup, r=RalfJung
Rustup

Also remove ICEing `breakpoint` intrinsic shim.
2020-04-01 17:59:33 +00:00
Ralf Jung
1e3800ffb1 rustup 2020-04-01 19:40:10 +02:00
Ralf Jung
3911388e06 remove ICEin intrinsic 2020-04-01 19:12:26 +02:00
JOE1994
b3f9e53049 Implement 'GetSystemTimeAsFileTime' shim for Windows 2020-04-01 10:55:26 -04:00
Ralf Jung
1cfd80ea2d rustup; fix Windows env var memory type 2020-03-30 22:13:53 +02:00
bors
319f2dd9e1 Auto merge of #1279 - divergentdave:open_O_EXCL, r=RalfJung
Add support for OpenOptions::create_new()/O_EXCL

This PR extends the POSIX shim for `open` to support the `O_EXCL` flag, when it is used alongside `O_CREAT`, and exercises it by testing `OpenOptions::create_new`.
2020-03-30 15:49:45 +00:00
Ralf Jung
8948a29a4c adjust for librustc rename; reduce 'extern crate' to rustc crates 2020-03-30 11:07:32 +02:00
Ralf Jung
5ff7eef2ff rustup; fix for TyLayout rename 2020-03-30 10:23:04 +02:00
David Cook
808709c288 Add support for OpenOptions::create_new()/O_EXCL 2020-03-29 16:06:41 -05:00
JOE1994
ed1305d986 fix fn read_path_from_wide_str 2020-03-29 16:01:07 -04:00
JOE1994
a458cf3fe6 make 'fn convert_path_separator' to take Cow<> (to remove unnecessary allocation) 2020-03-29 14:19:59 -04:00
JOE1994
9bdb4bbbbf Move definition of 'fn windows_check_buffer_size' to top of 'src/shims/env.rs' 2020-03-29 13:13:42 -04:00
JOE1994
1b0abc5797 small refactorings to 'src/shims/os_str.rs' & 'src/shims/env.rs' 2020-03-29 13:10:23 -04:00
JOE1994
1667ded0d2 fix fn GetCurrentDirectoryW + clarify return types of Windows shims 2020-03-29 11:30:42 -04:00
JOE1994
7e0cc8307e fix 'magic boolean' to enum 2020-03-29 11:30:08 -04:00
JOE1994
fe9ecb50d1 Follow-up to reviews from RalfJung
1. Fix 'fn convert_path_separator' in src/shims/os_str.rs
2. Fix 'fn set_last_error_from_io_error' in src/helpers.rs
3. Minor comment fix for 'fn SetCurrentDirectoryW' in src/shims/env.rs
2020-03-29 11:30:08 -04:00
JOE1994
1141b21e50 Windows shims for GetCurrentDirectoryW/SetCurrentDirectoryW 2020-03-29 11:30:08 -04:00
JOE1994
a481b8f261 partially implement 'set_last_error_from_io_error' for Windows 2020-03-29 11:30:08 -04:00
Ralf Jung
f181e75db2 rustup 2020-03-29 10:01:31 +02:00
bors
7a5e95c9ac Auto merge of #1276 - RalfJung:scalar-precise-sizes, r=RalfJung
Construct Scalar with precise sizes
2020-03-28 18:16:13 +00:00
Ralf Jung
d6795a77b4 precise getrandom return type and align_offset arithmetic 2020-03-28 17:47:00 +01:00
Ralf Jung
b7fec6b17f use ptr_null where appropriate 2020-03-28 17:38:38 +01:00
Ralf Jung
fbbca59de7 avoid Scalar::from_(u)int in favor of giving the size explicitly 2020-03-28 17:35:40 +01:00
bors
ad14b684cc Auto merge of #1275 - JOE1994:move_string_helpers, r=RalfJung
move OsStr helpers to a separate file

Moved OsStr read/write functions from `src/helpers.rs` to `src/shims/os_str.rs`, in order to keep `src/helpers.rs` from bloating too much.
2020-03-28 15:32:16 +00:00
JOE1994
4a70ebc1f3 visually separate conditional imports in 'os_str.rs' 2020-03-28 11:20:16 -04:00
JOE1994
99600ba7a9 move OsStr helpers to a separate file 2020-03-28 10:43:47 -04:00
Ralf Jung
a6cab24dc0 we don't deallocate the environ global, so leave it in the machine 2020-03-28 14:32:50 +01:00
bors
f0afdc35d2 Auto merge of #1263 - RalfJung:shims-limit, r=RalfJung
Limit shims to libstd where possible

Also organize them better by category.
Fixes https://github.com/rust-lang/miri/issues/1181 (by making mmap not callable from user code)
2020-03-28 10:35:11 +00:00
Ralf Jung
6ab82f5d35 posix_fadvise is Linux-only; also validate arguments a bit 2020-03-28 11:33:56 +01:00
Ralf Jung
9e39bfbbd9 organize shims and make some only available to libstd as they are incomplete 2020-03-28 11:15:11 +01:00
bors
b67dbca5d0 Auto merge of #1271 - RalfJung:env-clean, r=RalfJung
env shim: make sure we clean up all the memory we allocate

`Machine` memory is not leak-checked, so if we forgot to deallocate part of the env shim memory, we wouldn't even notice. Thus add a dedicated memory kind that is leak-checked.
2020-03-28 10:09:11 +00:00
Ralf Jung
204c13b8c7 env shim: make sure we clean up all the memory we allocate 2020-03-28 11:06:56 +01:00
Ralf Jung
876bded2e8 run Windows TLS dtor function 2020-03-28 10:39:29 +01:00
Ralf Jung
02897e03cf cleanup tcx usage and a few comments 2020-03-28 09:50:24 +01:00
bors
f4308a0728 Auto merge of #1267 - RalfJung:macos-dtors, r=RalfJung
implement TLS cleanup for macOS

Now that I can run macOS interpretation locally, this was not that hard to fix. ;)
Fixes https://github.com/rust-lang/miri/issues/443
2020-03-28 07:55:42 +00:00
Ralf Jung
579b3c49da
adjust MemoryKind comment 2020-03-27 20:36:18 +01:00
Ralf Jung
da5f2f305b implement TLS cleanup for macOS 2020-03-27 19:39:00 +01:00
Youngsuk Kim
3fe71dff5a
Modify reference to issue 1013
Co-Authored-By: Ralf Jung <post@ralfj.de>
2020-03-27 10:15:35 -04:00
JOE1994
eaca17fcc3 add reference to issue#1013 2020-03-27 09:59:42 -04:00
JOE1994
f3e3af4bee adjust to change of 'fn write_os_str_to_wide_str' 2020-03-27 09:18:13 -04:00
JOE1994
4e38fbe6be follow-up2 to review (few issues not resolved yet) 2020-03-27 08:43:50 -04:00
JOE1994
2051805e95 follow-up to reviews 2020-03-27 08:43:50 -04:00
JOE1994
cf5822af46 exclude 'TERM' env_var to avoid terminfo trying to open the termcap file 2020-03-27 08:43:08 -04:00
JOE1994
2fa07009f2 Windows shims for env var emulation
Shims for GetEnvironmentVariableW / SetEnvironmentVariableW /
GetEnvironmentStringsW.
Passes test 'tests/run-pass/env.rs'
2020-03-27 08:43:08 -04:00
Ralf Jung
07f7083409
env: more precise error 2020-03-27 12:35:08 +01:00
JOE1994
813d76d948 follow-up to reviews 2020-03-27 07:07:21 -04:00
JOE1994
160ebaa364 add OS-specific handling to src/shims/env.rs 2020-03-27 00:10:45 -04:00
JOE1994
fc8f88e04e change helper fn 'write_os_str_to_wide_str' 2020-03-27 00:08:27 -04:00
Ralf Jung
81d505670b rustup; get rid of some try_from that are no longer needed 2020-03-26 00:11:50 +01:00
Ralf Jung
8ffbca797f bump xargo version 2020-03-25 12:11:05 +01:00
Ralf Jung
962e2105df remove an unnecessary as_str 2020-03-25 09:32:15 +01:00
Ralf Jung
47b91e619a test unreachable intrinsic 2020-03-25 09:32:15 +01:00
Ralf Jung
9b0e9dec49 rustup, adjust for renames 2020-03-25 09:05:30 +01:00
Ralf Jung
e9e04e56fc move path methods together, to the bottom of the string helpers 2020-03-24 09:11:48 +01:00
Ralf Jung
c4e29c8646 convert dir separators on path load/store 2020-03-24 09:11:48 +01:00
Ralf Jung
4ac91384ff route all path reading/writing through central read/write methods 2020-03-24 09:11:47 +01:00
bors
ad7089f194 Auto merge of #1258 - RalfJung:rustup, r=RalfJung
Rustup
2020-03-24 07:29:25 +00:00
Ralf Jung
87f5495715 32bit macOS is no more 2020-03-24 08:25:37 +01:00
Ralf Jung
80088e131b rustup for trait MachineStopType 2020-03-24 08:24:36 +01:00
JOE1994
5f9167bdaa helper functions for env_var emulation in Windows 2020-03-23 19:40:22 -04:00
Ralf Jung
284067cc15 rustup 2020-03-23 23:48:24 +01:00
Ralf Jung
2f371774ef fix conditional compilation condition for os_str <-> bytes conversion 2020-03-23 19:43:03 +01:00
Ralf Jung
b4b8750e44 bump Rust; HashMap should now work on macOS even with isolation 2020-03-23 10:34:15 +01:00
Ralf Jung
6e302b830a link to some websites for UB explanations 2020-03-22 23:32:19 +01:00
Ralf Jung
dd4fef0cd9 fix outdated sysroot help message 2020-03-22 20:09:14 +01:00
Ralf Jung
6dcca62b63 move -Zmiri-disable-isolation hint to help 2020-03-22 19:48:59 +01:00
Ralf Jung
a1b823886c give some context in error messages 2020-03-22 18:59:06 +01:00
Ralf Jung
d85f09c4e4 platform -> target 2020-03-22 08:55:39 +01:00
Ralf Jung
238ed49a07 detect UB: overflow in copy/write_bytes 2020-03-21 17:54:33 +01:00
Ralf Jung
6355228d4e remove no longer needed (and sometimes broken) 'extern crate' 2020-03-21 13:13:08 +01:00
bors
b2605d809d Auto merge of #1241 - RalfJung:dont-panic, r=RalfJung
whitelist platforms where panicking should work

@CAD97 [proposed](https://github.com/rust-lang/miri/issues/1059#issuecomment-601217992) trying to get a better error for failed panics on Windows.

Could you test if this works for you?
2020-03-21 09:55:23 +00:00
Ralf Jung
bde3111c61 test windows panic message 2020-03-21 10:17:57 +01:00
Ralf Jung
f430e54456 implement mach_absolute_time for macOS 2020-03-20 16:15:37 +01:00
Ralf Jung
04c937e281 assert platform in time shims 2020-03-20 15:11:54 +01:00
Ralf Jung
4608b94bd8 implement CLOCK_MONOTONIC on Linux 2020-03-19 23:01:24 +01:00
Ralf Jung
0f1713f67c whitelist platforms where panicking should work 2020-03-19 15:54:09 +01:00
Ralf Jung
681819c8ad getting a path should never fail
we basically treat them as lang items
2020-03-19 08:26:08 +01:00
Ralf Jung
e6e8773272 start messages in lower-case 2020-03-19 08:25:08 +01:00
Ralf Jung
1103a10e2c adjust for error reform 2020-03-19 08:25:08 +01:00
bors
6b56aefa0b Auto merge of #1239 - elichai:2020-03-abort-intrinsics, r=RalfJung
Abort instead of panic on asserting intrinsics

This fixes #1222
replacing the panic with an abort and a corresponding message.
the stack trace is already printed, this just adds an optional message the caller can pass, and I just pass the same message we passed to the panic but now to the abort instead.

r? @RalfJung
2020-03-18 12:20:30 +00:00
Elichai Turkel
52e1372e03
Abort instead of panic in asserting intrinsics, because they might not be panic safe 2020-03-18 14:14:23 +02:00
Elichai Turkel
1b8979c8c7
Add an optional message to abort 2020-03-18 14:14:23 +02:00
Ralf Jung
b82cf36117 rustup; remove no longer existing intrinsics 2020-03-17 21:11:19 +01:00
Ralf Jung
8b6af3eacb avoid using unchecked casts or arithmetic 2020-03-17 15:21:43 +01:00
Youngsuk Kim
a664156440
Minor typo fix
"initializiation" => "initialization"
2020-03-15 18:06:21 -04:00
Ralf Jung
17a677f4a9 abort intrinsic is handled by librustc_mir now 2020-03-15 11:17:07 +01:00
Ralf Jung
1c4f27f1b2 adjust Miri to needs of changed unwinding strategy 2020-03-15 10:59:07 +01:00
Ralf Jung
a92b2274ce fix typo and deduplicate comment 2020-03-14 12:05:25 +01:00
Ralf Jung
497fbcbf44 rustup, fix for intrinsic rename and transmute error change 2020-03-14 09:27:35 +01:00
Ralf Jung
13ae3147f0 refactor handling of diverging intrinsics/foreign functions 2020-03-12 21:20:16 +01:00
Ralf Jung
5531a79f4c rustup, test Abort terminator 2020-03-12 20:48:04 +01:00
bors
0f22d8a208 Auto merge of #1213 - lcnr:master, r=RalfJung
rm custom `intrinsics::discriminant_value`

@RalfJung requires https://github.com/rust-lang/rust/pull/69825
2020-03-12 16:50:12 +00:00
Ralf Jung
76ee8ff458 use ctfe_backtracte variable for backtrace control 2020-03-11 20:39:18 +01:00
Ralf Jung
45d5a37787 rustup+fix 2020-03-11 20:39:18 +01:00
Ralf Jung
548c90e102 share some code between panic intrinsics, and fix the message 2020-03-11 19:53:07 +01:00
Elichai Turkel
e81ebffa59
Implement panic_if_any_invalid and panic_if_zero_invalid intrinsics 2020-03-11 16:00:08 +02:00
Ralf Jung
8394456247 properly panic in panic_if_uninhabited and align_offset shims 2020-03-08 20:00:40 +01:00
Christian Poveda
5dc60d974b
move environ place to EnvVars 2020-03-08 11:58:20 -05:00
Ralf Jung
87dbf10e84 move environ init to update_environ 2020-03-08 17:21:02 +01:00
Christian Poveda
8392a0c589
only expose environ on linux 2020-03-08 10:16:31 -05:00
Bastian Kauschke
6fd3c9174c rm custom intrinsics::discriminant_value 2020-03-08 14:31:57 +01:00
Christian Poveda
18a71ef7b3
minor corrections 2020-03-07 11:35:00 -05:00
Christian Poveda
e31b8b3342
add _NSGetEnviron foreign function for macos 2020-03-07 10:06:20 -05:00
Christian Poveda
aedc34c6e5
deallocate old environ 2020-03-06 18:11:05 -05:00
Ralf Jung
7882dfb3f5
fix env update, and expand test 2020-03-06 08:21:53 -05:00
Christian Poveda
4f5fdc5810
update the environ shim when environment changes 2020-03-06 08:21:52 -05:00
Christian Poveda
d13fe01f82
add working shim for environ 2020-03-06 08:19:56 -05:00
Ralf Jung
ade4c4e733 make the new option actually do something 2020-03-06 09:11:41 +01:00
Ralf Jung
d82d701360 add option to track a particular AllocId (does nothing yet) 2020-03-06 09:06:23 +01:00