| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Miri: use extern fn to expose interpreter operations to program; fix leak checker on Windows
This PR realizes an idea that @oli-obk has been suggesting for a while: to use Miri-specific `extern` functions to provide some extra capabilities to the program. Initially, we have two of these methods, which libstd itself needs:
* `miri_start_panic`, which replaces the intrinsic of the same name (mostly for consistency, to avoid having multiple mechanisms for Miri-specific functionality).
* `miri_static_root`, which adds an allocation to a list of static "roots" that Miri considers as not having leaked (including all memory reachable through them). This is needed for https://github.com/rust-lang/miri/issues/1302.
We use `extern` functions instead of intrinsics for this so that user code can more easily call these Miri hoolks -- e.g. `miri_static_root` should be useful for https://github.com/rust-lang/miri/issues/1318.
The Miri side of this is at https://github.com/rust-lang/miri/pull/1485.
r? @oli-obk
|
|
revise RwLock for HermitCore
- current version is derived from the wasm implementation
- increasing the readability of `Condvar`
- simplify the interface to the libos
|
|
|
|
|
|
Remove Linux workarounds for missing CLOEXEC support
Now that #74163 updated the minimum Linux kernel to 2.6.32, we can
assume the availability of APIs that open file descriptors that are
already set to close on exec, including the flags `O_CLOEXEC`,
`SOCK_CLOEXEC`, and `F_DUPFD_CLOEXEC`.
Closes #74519.
|
|
Prefer constant over function
Just that I prefer constants over functions that can be made const.
|
|
libstd/libcore: fix various typos
|
|
|
|
|
|
Now that #74163 updated the minimum Linux kernel to 2.6.32, we can
assume the availability of APIs that open file descriptors that are
already set to close on exec, including the flags `O_CLOEXEC`,
`SOCK_CLOEXEC`, and `F_DUPFD_CLOEXEC`.
|
|
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.
|
|
Remove combine function
Comparing two array directly helps generate better assert message.
Resolve https://github.com/rust-lang/rust/pull/74271/files#r454538514
|
|
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
|
|
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.
|
|
Enable some timeouts in SGX platform
This would partially resolve https://github.com/fortanix/rust-sgx/issues/31
cc @jethrogb and @Goirad
|
|
|
|
|
|
Added docs for `From<c_int>` for `ExitStatus`
Partially addresses https://github.com/rust-lang/rust/issues/51430
|
|
|
|
Comparing two array directly helps generate better assert message
|
|
process_unix: prefer i32::*_be_bytes over manually shifting bytes
This PR makes it more clear about the intend of the code.
|
|
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.
|
|
Refactor Windows `parse_prefix`
These changes make me feel more readable.
See the commit messages for more details.
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
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.
|
|
This adds `read_exact_at` and `write_all_at` to WASI's `FileExt`,
similar to the Unix versions of the same names.
|
|
libstd: remove some mutable statics in sys::unix
My understanding is that this achieves the same behavior and performance with safe code.
|
|
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.
|
|
[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
|
|
|
|
This adjusts the return type of Windows' `OpenOptionsExt::security_qos_flags`
to be consistent with the other functions in the trait.
|
|
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.
|
|
|
|
|
|
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.
|
|
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`.
|