about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
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.
2022-07-13Stabilize `core::ffi:c_*` and rexport in `std::ffi`Josh Triplett-1/+6
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.
2022-07-14Rename `std::io::Error::try_downcast_inner` to `downcast`Jiahao XU-11/+11
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-12Add a `File::create_new` constructorJosh Triplett-0/+29
We have `File::create` for creating a file or opening an existing file, but the secure way to guarantee creating a new file requires a longhand invocation via `OpenOptions`. Add `File::create_new` to handle this case, to make it easier for people to do secure file creation.
2022-07-12std: fix issue with perma-locked mutexes on Fuchsiajoboet-9/+20
2022-07-11apply suggestions from code reviewJane Losare-Lusby-7/+8
2022-07-11Add Read Impl for &StdinAïssata-0/+23
2022-07-11Auto merge of #97841 - nvzqz:inline-encode-wide, r=thomccbors-0/+1
Inline Windows `OsStrExt::encode_wide` User crates currently produce much more code than necessary because the optimizer fails to make assumptions about this method.
2022-07-11Add std::fs::write documentation precisionLucas Dumont-0/+6
As mentioned in #97947, the documentation is updated
2022-07-09Auto merge of #98950 - ChrisDenton:getoverlapped-io, r=thomccbors-8/+53
Windows: Fallback for overlapped I/O Fixes #98947
2022-07-09Document and stabilize process_set_process_groupNiklas Fiekas-3/+28
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-08Support unstable moves via stable in unstable itemsJane Lusby-2/+3
2022-07-07Rollup merge of #97917 - AronParker:master, r=ChrisDentonMatthias Krüger-0/+45
Implement ExitCodeExt for Windows Fixes #97914 ### Motivation: On Windows it is common for applications to return `HRESULT` (`i32`) or `DWORD` (`u32`) values. These stem from COM based components ([HRESULTS](https://docs.microsoft.com/en-us/windows/win32/api/objbase/nf-objbase-coinitialize)), Win32 errors ([GetLastError](https://docs.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror)), GUI applications ([WM_QUIT](https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-quit)) and more. The newly stabilized `ExitCode` provides an excellent fit for propagating these values, because `std::process::exit` does not run deconstructors which can result in errors. However, `ExitCode` currently only implements `From<u8> for ExitCode`, which disallows the full range of `i32`/`u32` values. This pull requests attempts to address that shortcoming by providing windows specific extensions that accept a `u32` value (which covers all possible `HRESULTS` and Win32 errors) analog to [ExitStatusExt::from_raw](https://doc.rust-lang.org/std/os/windows/process/trait.ExitStatusExt.html#tymethod.from_raw). This was also intended by the original Stabilization https://github.com/rust-lang/rust/pull/93840#issue-1129209143= as pointed out by ``@eggyal`` in https://github.com/rust-lang/rust/issues/97914#issuecomment-1151076755: > Issues around platform specific representations: We resolved this issue by changing the return type of report from i32 to the opaque type ExitCode. __That way we can change the underlying representation without affecting the API, letting us offer full support for platform specific exit code APIs in the future.__ [Emphasis added] ### API ```rust /// Windows-specific extensions to [`process::ExitCode`]. /// /// This trait is sealed: it cannot be implemented outside the standard library. /// This is so that future additional methods are not breaking changes. #[stable(feature = "windows_process_exit_code_from", since = "1.63.0")] pub trait ExitCodeExt: Sealed { /// Creates a new `ExitCode` from the raw underlying `u32` return value of /// a process. #[stable(feature = "windows_process_exit_code_from", since = "1.63.0")] fn from_raw(raw: u32) -> Self; } #[stable(feature = "windows_process_exit_code_from", since = "1.63.0")] impl ExitCodeExt for process::ExitCode { fn from_raw(raw: u32) -> Self { process::ExitCode::from_inner(From::from(raw)) } } ``` ### Misc I apologize in advance if I misplaced any attributes regarding stabilzation, as far as I learned traits are insta-stable so I chose to make them stable. If this is an error, please let me know and I'll correct it. I also added some additional machinery to make it work, analog to [ExitStatus](https://doc.rust-lang.org/std/process/struct.ExitStatus.html#). EDIT: Proposal: https://github.com/rust-lang/libs-team/issues/48
2022-07-07Fix doc build on unsupported osesDavid CARLIER-2/+16
2022-07-06changes from feedbackDavid Carlier-18/+12
2022-07-06doc additionsDavid Carlier-1/+38
2022-07-06socket `set_mark` addition.David Carlier-0/+16
to be able to set a marker/id on the socket for network filtering (iptables/ipfw here) purpose.
2022-07-06Tests for unsound Windows file methodsChris Denton-0/+25
2022-07-06Windows: Fallback for overlapped I/OChris Denton-1/+26
Try waiting on the file handle once. If that fails then give up.
2022-07-06Use `rtabort!` instead of `process::abort`Chris Denton-7/+2
2022-07-06Fix typo in file descriptor docsFlorian Spieß-1/+1
2022-07-05Add `BufRead::skip_until`William Venner-0/+84
2022-07-05Test if `[try_]exists` can find `hiberfil.sys`Chris Denton-2/+4