Commit Graph

2150 Commits

Author SHA1 Message Date
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