about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2022-07-25Rollup merge of #95916 - solid-rs:feat-kmc-solid-abort, r=Mark-SimulacrumYuki Okushi-45/+5
kmc-solid: Use `libc::abort` to abort a program This PR updates the target-specific abort subroutine for the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets. The current implementation uses a `hlt` instruction, which is the most direct way to notify a connected debugger but is not the most flexible way. This PR changes it to call the `abort` libc function, making it possible for a system designer to override its behavior as they see fit.
2022-07-25Rollup merge of #95040 - frank-king:fix/94981, r=Mark-SimulacrumYuki Okushi-0/+20
protect `std::io::Take::limit` from overflow in `read` Resolves #94981
2022-07-25remove useless mut from examplessourcelliu-4/+4
2022-07-24Rename and document the new BufReader internalsBen Kimock-29/+33
2022-07-24Allow Buffer methods to inlineBen Kimock-0/+9
2022-07-24Remove some redundant checks from BufReaderBen Kimock-53/+106
The implementation of BufReader contains a lot of redundant checks. While any one of these checks is not particularly expensive to execute, especially when taken together they dramatically inhibit LLVM's ability to make subsequent optimizations.
2022-07-23Remove `mut`Phosra-1/+1
2022-07-23Auto merge of #97925 - the8472:cgroupv1, r=joshtriplettbors-47/+196
Add cgroupv1 support to available_parallelism Fixes #97549 My dev machine uses cgroup v2 so I was only able to test that code path. So the v1 code path is written only based on documentation. I could use some help testing that it works on a machine with cgroups v1: ``` $ x.py build --stage 1 # quota.rs fn main() { println!("{:?}", std::thread::available_parallelism()); } # assuming stage1 is linked in rustup $ rust +stage1 quota.rs # spawn a new cgroup scope for the current user $ sudo systemd-run -p CPUQuota="300%" --uid=$(id -u) -tdS # should print Ok(3) $ ./quota ``` If it doesn't work as expected an strace, the contents of `/proc/self/cgroups` and the structure of `/sys/fs/cgroups` would help.
2022-07-22[review] mention that runtime may scale with # of mountpointsthe8472-0/+5
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2022-07-22Recover error strings on Unix from_lossy_utf8Jubilee Young-1/+3
Some language settings can result in unreliable UTF-8 being produced. This can result in failing to emit the error string, panicking instead. from_lossy_utf8 allows us to assume these strings usually will be fine.
2022-07-22Stub out `set_times` to return unsupported on RedoxJosh Triplett-2/+13
Redox doesn't appear to support `UTIME_OMIT`, so we can't set file times individually.
2022-07-21document memory orderings of `thread::{park, unpark}`Ibraheem Ahmed-9/+19
2022-07-21Rollup merge of #99523 - cuviper:asfd_ptrs-1.64, r=jyn514Matthias Krüger-2/+2
Fix the stable version of `AsFd for Arc<T>` and `Box<T>` These merged in #97437 for 1.64.0, apart from the main `io_safety` feature that stabilized in 1.63.0.
2022-07-21Rollup merge of #98707 - joboet:fuchsia_locks, r=m-ou-seMatthias Krüger-64/+256
std: use futex-based locks on Fuchsia This switches `Condvar` and `RwLock` to the futex-based implementation currently used on Linux and some BSDs. Additionally, `Mutex` now has its own, priority-inheriting implementation based on the mutex in Fuchsia's `libsync`. It differs from the original in that it panics instead of aborting when reentrant locking is detected. ````@rustbot```` ping fuchsia r? ````@m-ou-se````
2022-07-21remove unused importjoboet-1/+1
2022-07-20Fix the stable version of `AsFd for Arc<T>` and `Box<T>`Josh Stone-2/+2
These merged in #97437 for 1.64.0, apart from the main `io_safety` feature that stabilized in 1.63.0.
2022-07-20owner is not micro (correct typo)joboet-1/+1
2022-07-20Rollup merge of #98101 - vladimir-ea:stdlib_watch_os, r=thomccDylan DPC-25/+70
stdlib support for Apple WatchOS This is a follow-up to https://github.com/rust-lang/rust/pull/95243 (Add Apple WatchOS compiler targets) that adds stdlib support for Apple WatchOS. `@deg4uss3r` `@nagisa`
2022-07-20Library changes for Apple WatchOSVladimir Michael Eatwell-25/+70
2022-07-20Rollup merge of #98916 - ChrisDenton:hiberfil.sys, r=thomccDylan DPC-26/+99
Windows: Use `FindFirstFileW` for getting the metadata of locked system files Fixes #96980 Usually opening a file handle with access set to metadata only will always succeed, even if the file is locked. However some special system files, such as `C:\hiberfil.sys`, are locked by the system in a way that denies even that. So as a fallback we try reading the cached metadata from the directory. Note that the test is a bit iffy. I don't know if `hiberfil.sys` actually exists in the CI. r? rust-lang/libs
2022-07-19Improve the function pointer docsMichael Howell-10/+50
* Reduce duplicate impls; show only the `fn (T)` and include a sentence saying that there exists up to twelve of them. * Show `Copy` and `Clone`. * Show auto traits like `Send` and `Sync`, and blanket impls like `Any`.
2022-07-18Ignore `hiberfil_sys` test in CIChris Denton-1/+4
The file it's testing does not exist in the CI environment.
2022-07-18std: panic instead of deadlocking in mutex implementation on Fuchsiajoboet-16/+15
2022-07-17rustdoc: extend `#[doc(tuple_variadic)]` to fn pointersMichael Howell-2/+2
The attribute is also renamed `fake_variadic`.
2022-07-17Simplify Windows `hashmap_random_keys`Chris Denton-60/+8
2022-07-17Move SocketAddrCRepr to sys_commonLinus Färnstrand-31/+35
2022-07-17Rollup merge of #99302 - yaahc:gma-tracking-issue, r=joshtriplettYuki Okushi-8/+8
add tracking issue to generic member access APIs Missed as part of https://github.com/rust-lang/rust/pull/98072
2022-07-17Rollup merge of #99088 - niklasf:stabilize-process_set_process_group, ↵Yuki Okushi-3/+30
r=joshtriplett Document and stabilize process_set_process_group Tracking issue: https://github.com/rust-lang/rust/issues/93857 FCP finished here: https://github.com/rust-lang/rust/issues/93857#issuecomment-1179551697
2022-07-17Rollup merge of #97915 - tbu-:pr_os_string_fmt_write, r=joshtriplettYuki Okushi-0/+8
Implement `fmt::Write` for `OsString` This allows to format into an `OsString` without unnecessary allocations. E.g. ``` let mut temp_filename = path.into_os_string(); write!(&mut temp_filename, ".tmp.{}", process::id()); ```
2022-07-16Stabilize `let_chains`Caio-1/+1
2022-07-16Expand documentation for `process_group` Josh Triplett-1/+3
Explain PGID 0, and provide the acronym PGID.
2022-07-16Update `since` version to 1.64Josh Triplett-1/+1
2022-07-16Rollup merge of #99277 - joshtriplett:stabilize-core-cstr-alloc-cstring, ↵Yuki Okushi-21/+4
r=Mark-Simulacrum Stabilize `core::ffi::CStr`, `alloc::ffi::CString`, and friends Stabilize the `core_c_str` and `alloc_c_string` feature gates. Change `std::ffi` to re-export these types rather than creating type aliases, since they now have matching stability.
2022-07-16Rollup merge of #99264 - eltociear:patch-14, r=compiler-errorsYuki Okushi-1/+1
Fix typo in mod.rs constuct -> construct
2022-07-16Rollup merge of #98662 - LucasDumont:document_fs_write, r=thomccYuki Okushi-0/+6
Add std::fs::write documentation precision Fixes #97947. As mentioned in #97947, the documentation is updated
2022-07-16Rollup merge of #98387 - NobodyXu:feature/std_io_Error_try_downgrade_inner, ↵Yuki Okushi-1/+127
r=yaahc Add new unstable API `downcast` to `std::io::Error` https://github.com/rust-lang/libs-team/issues/57 Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-15add tracking issue to generic member access APIsJane Losare-Lusby-8/+8
2022-07-15Apply suggestions from code reviewJane Losare-Lusby-1/+1
2022-07-15Stabilize `core::ffi::CStr`, `alloc::ffi::CString`, and friendsJosh Triplett-21/+4
Stabilize the `core_c_str` and `alloc_c_string` feature gates. Change `std::ffi` to re-export these types rather than creating type aliases, since they now have matching stability.
2022-07-15Don't fall back to futimes on Android; it needs a newer API level than futimensJosh Triplett-7/+18
Just return `io::ErrorKind::Unsupported` instead.
2022-07-15Also use fallback for futimens on AndroidJosh Triplett-3/+3
futimens requires Android API level 19, and std still supports older API levels.
2022-07-15Return an error if trying to set a file timestamp to 0 on WindowsJosh Triplett-5/+12
This would otherwise silently ignore the attempt, since 0 serves as a flag to not set a timestamp.
2022-07-15Add alias `File::set_modified` as shorthandJosh Triplett-0/+9
2022-07-15Support setting file accessed/modified timestampsJosh Triplett-2/+222
Add `struct FileTimes` to contain the relevant file timestamps, since most platforms require setting all of them at once. (This also allows for future platform-specific extensions such as setting creation time.) Add `File::set_file_time` to set the timestamps for a `File`. Implement the `sys` backends for UNIX, macOS (which needs to fall back to `futimes` before macOS 10.13 because it lacks `futimens`), Windows, and WASI.
2022-07-15Fix typo in mod.rsIkko Ashimine-1/+1
constuct -> construct
2022-07-15Improve example of `downcast`Jiahao XU-3/+4
Co-authored-by: Jane Losare-Lusby <jlusby42@gmail.com>
2022-07-14Auto merge of #99242 - Dylan-DPC:rollup-34bqdh8, r=Dylan-DPCbors-1/+117
Rollup of 6 pull requests Successful merges: - #98072 (Add provider API to error trait) - #98580 (Emit warning when named arguments are used positionally in format) - #99000 (Move abstract const to middle) - #99192 (Fix spans for asm diagnostics) - #99222 (Better error message for generic_const_exprs inference failure) - #99236 (solaris: unbreak build on native platform) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-14Rollup merge of #98072 - yaahc:generic-member-access, r=thomccDylan DPC-1/+117
Add provider API to error trait Implements https://github.com/rust-lang/rfcs/pull/2895
2022-07-14Auto merge of #95956 - yaahc:stable-in-unstable, r=cjgillotbors-2/+3
Support unstable moves via stable in unstable items part of https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/moving.20items.20to.20core.20unstably and a blocker of https://github.com/rust-lang/rust/pull/90328. The libs-api team needs the ability to move an already stable item to a new location unstably, in this case for Error in core. Otherwise these changes are insta-stable making them much harder to merge. This PR attempts to solve the problem by checking the stability of path segments as well as the last item in the path itself, which is currently the only thing checked.
2022-07-14Rollup merge of #98315 - joshtriplett:stabilize-core-ffi-c, r=Mark-SimulacrumDylan DPC-1/+6
Stabilize `core::ffi:c_*` and rexport in `std::ffi` This only stabilizes the base types, not the non-zero variants, since those have their own separate tracking issue and have not gone through FCP to stabilize.