Commit Graph

4534 Commits

Author SHA1 Message Date
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
bors
7743a73be7 Auto merge of #1281 - RalfJung:rustup, r=RalfJung
adjust for librustc rename; reduce 'extern crate' to rustc crates
2020-03-30 09:09:20 +00:00
Ralf Jung
8948a29a4c adjust for librustc rename; reduce 'extern crate' to rustc crates 2020-03-30 11:07:32 +02:00
bors
a50d87f016 Auto merge of #1280 - RalfJung:rustup, r=RalfJung
rustup; fix for TyLayout rename
2020-03-30 08:24:40 +00:00
Ralf Jung
846ce3c261 test const-generic Vec::from(array) 2020-03-30 10:23:16 +02:00
Ralf Jung
5ff7eef2ff rustup; fix for TyLayout rename 2020-03-30 10:23:04 +02:00
bors
2d508739cb Auto merge of #1278 - JOE1994:cow, r=RalfJung
make 'fn convert_path_separator' to take 'Cow<>' as argument

Fixed `fn convert_path_separator()` to take `Cow<>` as argument,
in order to prevent unnecessary allocation when target & host path separators are equal.
2020-03-29 22:43:36 +00: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
bors
3504d52668 Auto merge of #1268 - JOE1994:dir, r=RalfJung
Windows shims for GetCurrentDirectoryW/SetCurrentDirectoryW

Implemented shims for Windows
* [GetCurrentDirectoryW](75208942f6/src/libstd/sys/windows/os.rs (L242)) (`getcwd` for Windows)
* [SetCurrentDirectoryW](75208942f6/src/libstd/sys/windows/os.rs (L250)) (`chdir` for Windows)

Currently passes test :
`./miri run tests/run-pass/current_dir.rs -Zmiri-disable-isolation`
2020-03-29 17:19:57 +00: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
bors
c706f50e3f Auto merge of #1277 - RalfJung:rustup, r=RalfJung
rustup

Fix for some renames
2020-03-29 08:02:10 +00: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
bors
3d3e2b65b9 Auto merge of #1274 - RalfJung:float-cast, r=RalfJung
fix float test comments and test a few more int->float casts
2020-03-28 14:47:42 +00:00
Ralf Jung
4e471f745f fix float test comments and test a few more int->float casts 2020-03-28 15:47:00 +01:00
JOE1994
99600ba7a9 move OsStr helpers to a separate file 2020-03-28 10:43:47 -04:00
bors
fc30266540 Auto merge of #1265 - RalfJung:float-cast, r=RalfJung
test floating point casting better
2020-03-28 14:19:29 +00:00
bors
c89076b43c Auto merge of #1273 - RalfJung:environ-cleanup, r=RalfJung
we don't deallocate the environ global, so leave it in the machine

Follow-up to https://github.com/rust-lang/miri/pull/1271. I forgot to adjust this when my plans changed a bit.
2020-03-28 13:33:57 +00: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
bors
f274111113 Auto merge of #1269 - RalfJung:windows-dtor, r=RalfJung
run Windows TLS dtor function

Mostly fixes https://github.com/rust-lang/miri/issues/442
2020-03-28 09:41:25 +00:00
Ralf Jung
876bded2e8 run Windows TLS dtor function 2020-03-28 10:39:29 +01:00
Ralf Jung
f751688396 miri build script: use incremental builds 2020-03-28 10:29:17 +01:00
Ralf Jung
02897e03cf cleanup tcx usage and a few comments 2020-03-28 09:50:24 +01:00
Ralf Jung
b8a817fc03 avoid promotion so this can be compared with rustc 2020-03-28 09:20:07 +01:00
Ralf Jung
032d9aa7d5 also do some float-to-float cast testing 2020-03-28 09:10:34 +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
bors
01bc08a372 Auto merge of #1225 - JOE1994:rw_widestr, r=RalfJung
Add shims for env var emulation in Windows

This PR attempts to implement the final step of the instructions laid out in https://github.com/rust-lang/miri/issues/707#issuecomment-561564057 , and is yet a work in progress.

### STATUS
- [x] Add general **_target_** methods for **read_str/alloc_str** that dispatch to either **c_str** or **wide_str** variants
(**helpers.rs**)
- [x] Implement shims `fn getenvironmentvariablew`/`fn setenvironmentvariablew`
(`std::env::var()`, `std::env::set_var()`)
- [x] Implement shim `GetEnvironmentStringsW` (`std::env::vars()`)
- [x] Implement shim `FreeEnvironmentStringsW`

### ISSUES (updated on 03/21/2020)
- MIRI errors while running `std::env::remove_var()` in Windows.
    MIRI complaining about raw pointer usage in
Rust standard library [*src/libstd/sys/windows/os.rs*](https://github.com/rust-lang/miri/pull/1225#issuecomment-602100146).

### TODO (probably on a separate PR)
  - Move string helpers into a new file to avoid bloating **src/helpers.rs** too much. (**shims/os_str.rs**)
2020-03-27 19:38:41 +00:00
Ralf Jung
579b3c49da
adjust MemoryKind comment 2020-03-27 20:36:18 +01:00
Ralf Jung
c5ef8a656f enable leak tests on macOS 2020-03-27 19:39:35 +01:00
Ralf Jung
da5f2f305b implement TLS cleanup for macOS 2020-03-27 19:39:00 +01:00
JOE1994
ea836eeb0d remove or update 'ignore-windows' annotations in some tests 2020-03-27 14:18:19 -04: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