about summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
2020-07-23Rollup merge of #74587 - lzutao:consts, r=dtolnayManish Goregaokar-27/+26
Prefer constant over function Just that I prefer constants over functions that can be made const.
2020-07-23Rollup merge of #74141 - euclio:typos, r=steveklabnikManish Goregaokar-8/+8
libstd/libcore: fix various typos
2020-07-23Prefer constant over functionLzu Tao-28/+27
2020-07-21Auto merge of #74075 - sunfishcode:wasi-prelude-rawfd, r=alexcrichtonbors-1/+1
Add `RawFd` to WASI's `std::os::wasi::prelude`. Add `RawFd` to WASI's `std::os::wasi::prelude`, making it consistent with all other platforms which also have `AsRawFd`, `FromRawFd`, and `IntoRawFd` in their respective preludes.
2020-07-19Rollup merge of #74356 - lzutao:rm_combine, r=LukasKalbertodtManish Goregaokar-7/+3
Remove combine function Comparing two array directly helps generate better assert message. Resolve https://github.com/rust-lang/rust/pull/74271/files#r454538514
2020-07-17Auto merge of #74395 - Mark-Simulacrum:stage0-next, r=pietroalbinibors-2/+2
Bump version to 1.47 This also bumps to a more recent rustfmt version, just to keep us relatively up to date (though almost nothing has changed in rustfmt we use beyond bumps to the parser infra). No formatting changes as a result of this. r? @pietroalbini
2020-07-16Rollup merge of #74033 - ehuss:std-compile-all-platforms, r=Mark-SimulacrumManish Goregaokar-105/+237
Add build support for Cargo's build-std feature. This makes some changes to the standard library to make it easier to use with Cargo's build-std feature. The primary goal is to make it so that Cargo and its users do not need to know which crates to build and which features to use for every platform. Conditional cfgs are adjusted so that there is usually a fall-through for unsupported platforms. Additionally, there is a "restricted-std" feature to mark `std` as unstable when used with build-std on no_std platforms. There is no intent to stabilize this feature for the foreseeable future. This borrows some of the implementation for wasm which already does what this needs. More code sharing can be done with some other platforms (there is a lot of duplication with cloudabi, hermit, and sgx), but I figure that can be done in a future PR. There are some small changes to stable behavior in this PR: - `std::env::consts::ARCH` on asmjs now reports "wasm32", to match its actual architecture. - Some of the wasm error messages for unsupported features report a slightly different error message so that the code can be reused. There should otherwise not be any changes to how std is built for distribution via bootstrap. This does not yet support all platforms when used with build-std. - It doesn't work with 16-bit targets (hashbrown does not support that). - It does not work with JSON spec targets. - In particular, all target triple snooping will need to be replaced with appropriate target option checking. - Switching to gimli (#73441) will make cross-building *much* easier. - There are still a ton of issues on the Cargo side to resolve. A big one is panic strategy support. Future PRs are intended to address some of these issues.
2020-07-16Rollup merge of #73269 - mzohreva:mz/sgx-wait-timeout, r=jethrogbManish Goregaokar-27/+213
Enable some timeouts in SGX platform This would partially resolve https://github.com/fortanix/rust-sgx/issues/31 cc @jethrogb and @Goirad
2020-07-16apply bootstrap cfgsMark Rousskov-2/+2
2020-07-15Move usercall_wait_timeout to abi::usercalls::wait_timeoutMohsen Zohrevandi-82/+74
2020-07-15Rollup merge of #74291 - regexident:from-docs, r=GuillaumeGomezManish Goregaokar-0/+4
Added docs for `From<c_int>` for `ExitStatus` Partially addresses https://github.com/rust-lang/rust/issues/51430
2020-07-15Introduce restricted-std feature.Eric Huss-105/+237
2020-07-15Remove combine functionLzu Tao-7/+3
Comparing two array directly helps generate better assert message
2020-07-14Rollup merge of #74271 - lzutao:cmdbytes, r=LukasKalbertodtManish Goregaokar-14/+12
process_unix: prefer i32::*_be_bytes over manually shifting bytes This PR makes it more clear about the intend of the code.
2020-07-14Rollup merge of #74263 - RalfJung:thread-local, r=Mark-SimulacrumManish Goregaokar-28/+27
Slight reorganization of sys/(fast_)thread_local I was long confused by the `thread_local` and `fast_thread_local` modules in the `sys(_common)` part of libstd. The names make it *sound* like `fast_thread_local` is just a faster version of `thread_local`, but really these are totally different APIs: one provides thread-local "keys", which are non-addressable pointer-sized pieces of local storage with an associated destructor; the other (the "fast" one) provides just a destructor. So I propose we rename `fast_thread_local` to `thread_local_dtor`, and `thread_local` to `thread_local_key`. That's what this PR does.
2020-07-14Rollup merge of #74220 - lzutao:windows-path-com, r=LukasKalbertodtManish Goregaokar-63/+97
Refactor Windows `parse_prefix` These changes make me feel more readable. See the commit messages for more details.
2020-07-14Rollup merge of #73866 - Goirad:fix-entry-improper-ctypes, r=davidtwcoManish Goregaokar-3/+5
Obviate #[allow(improper_ctypes_definitions)] Modifies the return type for `fn entry` so that allowing improper_ctypes_definitions is no longer necessary. This change is derived from a similar pattern in `libstd/sys/sgx/abi/usercalls/raw.rs` with `UsercallReturn`. cc @jethrogb
2020-07-14Added docs for `From<c_int>` for `ExitStatus`Vincent Esche-0/+4
2020-07-12process_unix: prefer i32::*_be_bytes over manually shifting bytesLzu Tao-14/+12
2020-07-12Reduce unsafe scopeLzu Tao-49/+48
2020-07-12Prefer empty OsStr over unsafe cast from [u8]Lzu Tao-1/+1
2020-07-12Rewrite parse_two_compsLzu Tao-10/+41
2020-07-12Make use of slice::strip_prefix and slice patternLzu Tao-27/+24
2020-07-12Make is_valid_drive_letter functionLzu Tao-2/+8
2020-07-12Move constants to top fileLzu Tao-2/+3
2020-07-12adjust remaining targetsRalf Jung-24/+20
2020-07-12rename fast_thread_local -> thread_local_dtor; thread_local -> thread_local_keyRalf Jung-6/+9
2020-07-10Rollup merge of #74076 - sunfishcode:wasi-fileext-newmethods, r=alexcrichtonManish Goregaokar-4/+137
Add `read_exact_at` and `write_all_at` to WASI's `FileExt` This adds `read_exact_at` and `write_all_at` to WASI's `FileExt`, similar to the Unix versions of the same names.
2020-07-10Address review commentsMohsen Zohrevandi-39/+34
2020-07-09libstd/libcore: fix various typosAndy Russell-8/+8
2020-07-07Make WASI's FileExt's read_at/write_at consistent with other targets.Dan Gohman-4/+43
Rename the existing read_at/write_at to read_vectored_at/write_vectored_at, for consistency with libstd's read_vectored/write_vectored. And, introduce new read_at/write_at functions which take a single buffer, similar to all other targets which provide these functions, so this will make it easier for applications to share code between WASI and other targets. Note that WASI's FileExt is currently unstable.
2020-07-07Add `read_exact_at` and `write_all_at` to WASI's `FileExt`Dan Gohman-0/+94
This adds `read_exact_at` and `write_all_at` to WASI's `FileExt`, similar to the Unix versions of the same names.
2020-07-07Auto merge of #74006 - euclio:sys-unix-static-mut, r=oli-obkbors-26/+33
libstd: remove some mutable statics in sys::unix My understanding is that this achieves the same behavior and performance with safe code.
2020-07-06Rollup merge of #74074 - sunfishcode:windows-openoptionsext-return-type, ↵Manish Goregaokar-1/+1
r=LukasKalbertodt Fix the return type of Windows' `OpenOptionsExt::security_qos_flags`. This adjusts the return type of Windows' `OpenOptionsExt::security_qos_flags` to be consistent with the other functions in the trait.
2020-07-06Rollup merge of #70563 - GuillaumeGomez:page-hash-handling, r=ollie27,kinnisonManish Goregaokar-2/+2
[rustdoc] Page hash handling Fixes https://github.com/rust-lang/rust/issues/70476 A good example to see the change is to use this URL: https://doc.rust-lang.org/nightly/std/string/struct.String.html#from_iter.v-3 After the change, it actually goes to the target element (and change the page hash to something more clear for the users). r? @kinnison cc @ollie27
2020-07-06libstd: remove some mutable statics in sys::unixAndy Russell-26/+33
2020-07-05Fix the return type of Windows' `OpenOptionsExt::security_qos_flags`.Dan Gohman-1/+1
This adjusts the return type of Windows' `OpenOptionsExt::security_qos_flags` to be consistent with the other functions in the trait.
2020-07-05Add `RawFd` to WASI's `std::os::wasi::prelude`.Dan Gohman-1/+1
Add `RawFd` to WASI's `std::os::wasi::prelude`, making it consistent with all other platforms which also have `AsRawFd`, `FromRawFd`, and `IntoRawFd` in their respective preludes.
2020-07-02Fix linksGuillaume Gomez-2/+2
2020-07-01Remove unnecessary check in SGX wait usercallMohsen Zohrevandi-2/+1
2020-07-01Rollup merge of #73752 - TyPR124:invalid-parameter-error, r=LukasKalbertodtManish Goregaokar-0/+1
Remap Windows ERROR_INVALID_PARAMETER to ErrorKind::InvalidInput from Other I don't know if this is acceptable or how likely it is to break existing code, but it seem to me ERROR_INVALID_PARAMETER "The parameter is incorrect" should map to ErrorKind::InvalidInput "A parameter was incorrect". Previously this value fell through to ErrorKind::Other. I can't speak for anyone but myself, but I instinctively thought it would be InvalidInput.
2020-06-29Obviate #[allow(improper_ctypes_definitions)]Dario Gonzalez-3/+5
Modifies the return type for `fn entry` so that allowing improper_ctypes_definitions is no longer necessary. This change is derived from a similar pattern in `libstd/sys/sgx/abi/usercalls/raw.rs` with `UsercallReturn`.
2020-06-28Rename the lint to clashing_extern_declarations.jumbatm-2/+2
Also, run RustFmt on the clashing_extern_fn test case and update stderrs.
2020-06-26Rollup merge of #72937 - AdrianCX:master, r=nikomatsakisManish Goregaokar-5/+9
Fortanix SGX target libunwind build process changes Ticket: https://github.com/fortanix/rust-sgx/issues/174 LLVM related changes (merged): https://github.com/rust-lang/llvm-project/pull/57 Description: libunwind changes needed to run code in sgx environment via rust-sgx. Target that uses this in rust: x86_64-fortanix-unknown-sgx. Without this change, rust std for this toolchain is forced to use a precompiled library loaded via environment variable. With this change we act the same as musl target.
2020-06-26Map ERROR_INVALID_PARAMETER to InvalidInputTyler Ruckinger-0/+1
2020-06-25Rollup merge of #72700 - davidtwco:issue-66220-improper-ctypes-declarations, ↵Dylan DPC-0/+1
r=lcnr,varkor `improper_ctypes_definitions` lint Addresses #19834, #66220, and #66373. This PR takes another attempt at #65134 (reverted in #66378). Instead of modifying the existing `improper_ctypes` lint to consider `extern "C" fn` definitions in addition to `extern "C" {}` declarations, this PR adds a new lint - `improper_ctypes_definitions` - which only applies to `extern "C" fn` definitions. In addition, the `improper_ctype_definitions` lint differs from `improper_ctypes` by considering `*T` and `&T` (where `T: Sized`) FFI-safe (addressing #66220). There wasn't a clear consensus in #66220 (where the issues with #65134 were primarily discussed) on the approach to take, but there has [been some discussion in Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.2366220.20improper_ctypes.20definitions.20vs.20declarations/near/198903086). I fully expect that we'll want to iterate on this before landing. cc @varkor + @shepmaster (from #19834) @hanna-kruppe (active in discussing #66220), @SimonSapin (#65134 caused problems for Servo, want to make sure that this PR doesn't)
2020-06-24Rollup merge of #73638 - yuqio:remove-unused-crate-imports, r=nikomatsakisDylan DPC-10/+0
Remove unused crate imports in 2018 edition crates Closes #73570
2020-06-24lints: add `improper_ctypes_definitions`David Wood-0/+1
This commit adds a new lint - `improper_ctypes_definitions` - which functions identically to `improper_ctypes`, but on `extern "C" fn` definitions (as opposed to `improper_ctypes`'s `extern "C" {}` declarations). Signed-off-by: David Wood <david@davidtw.co>
2020-06-24Update libunwind build process for x86_64-fortanix-unknown-sgx targetAdrian Cruceru-5/+9
2020-06-23Remove unused crate imports in 2018 edition cratesyuqio-10/+0