about summary refs log tree commit diff
path: root/library/std
AgeCommit message (Collapse)AuthorLines
2023-10-08Bump libc dependencySamuel Thibault-1/+1
To get GNU/Hurd support, so that CI of external repositories (e.g. getrandom) can build std.
2023-10-07std: fix registering of Windows TLS destructorsjoboet-1/+4
2023-10-07Auto merge of #109214 - tosti007:std_collection_hash_new_rework, ↵bors-1/+1
r=workingjubilee Use `HashMap::with_capacity_and_hasher` instead of using base Cleans up the internal logic for `HashMap::with_capacity` slightly.
2023-10-07Remove unnecessary tmp variable in default_read_exactWilfred Hughes-2/+1
This variable seems to serve no purpose, and it's a little confusing when reading std source code, so remove it.
2023-10-07Auto merge of #116318 - pitaj:android-backtrace-build, r=workingjubileebors-0/+12
Invoke `backtrace-rs` buildscript in `std` buildscript Based on #99883 by `@Arc-blroth` Depends on rust-lang/backtrace-rs#556 and rust-lang/cc-rs#705
2023-10-07Auto merge of #116501 - workingjubilee:rollup-fpzov6m, r=workingjubileebors-1/+1
Rollup of 4 pull requests Successful merges: - #116277 (dont call mir.post_mono_checks in codegen) - #116400 (Detect missing `=>` after match guard during parsing) - #116458 (Properly export function defined in test which uses global_asm!()) - #116500 (Add tvOS to target_os for register_dtor) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-06Rollup merge of #116500 - simlay:tvos-support-for-register_dtor, ↵Jubilee-1/+1
r=workingjubilee Add tvOS to target_os for register_dtor Closes #116491.
2023-10-06Auto merge of #114709 - ShE3py:wasi-io-error-more, r=workingjubileebors-23/+92
Use `io_error_more` on WASI #86442 added many variants to [`io::ErrorKind`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html), but `sys::wasi::decode_error_kind()` wasn't modified to use them. The preview1 `errno` list: https://github.com/WebAssembly/WASI/blob/4712d490fd7662f689af6faa5d718e042f014931/legacy/preview1/docs.md#-errno-variant Original implementation: #63814 `@rustbot` label +A-error-handling +C-enhancement +O-wasi
2023-10-06Add tvOS to target_os for register_dtorSebastian Imlay-1/+1
2023-10-06Rollup merge of #116484 - peterjoel:once-doc-clarify, r=cuviperMatthias Krüger-1/+1
Minor doc clarification in Once::call_once
2023-10-06Use `io_error_more` on WASIShE3py-23/+92
2023-10-06Auto merge of #116483 - GuillaumeGomez:rollup-z65pno1, r=GuillaumeGomezbors-0/+10
Rollup of 6 pull requests Successful merges: - #115454 (Clarify example in docs of str::char_slice) - #115522 (Clarify ManuallyDrop bit validity) - #115588 (Fix a comment in std::iter::successors) - #116198 (Add more diagnostic items for clippy) - #116329 (update some comments around swap()) - #116475 (rustdoc-search: fix bug with multi-item impl trait) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-06Minor doc clarification in Once::call_oncePeter Hall-1/+1
2023-10-06Rollup merge of #116198 - Jarcho:diag_items, r=WaffleLapkinGuillaume Gomez-0/+10
Add more diagnostic items for clippy
2023-10-06Auto merge of #111595 - fortanix:raoul/waitqueue_clarifications, ↵bors-7/+19
r=workingjubilee `waitqueue` clarifications for SGX platform The documentation of `waitqueue` functions on the `x86_64-fortanix-unknown-sgx` platform is incorrect at some places and on others missing. This PR improves upon this. cc: `@jethrogb`
2023-10-06Windows: Support sub-millisecond sleepChris Denton-1/+88
Use `CreateWaitableTimerExW` with `CREATE_WAITABLE_TIMER_HIGH_RESOLUTION`. Does not work before Windows 10, version 1803 so in that case we fallback to using `Sleep`.
2023-10-06Auto merge of #116463 - ChrisDenton:nlibc, r=workingjubileebors-13/+18
Remove libc We don't use much libc on Windows and it seemed silly to keep if for the sake of [two well documented constants](https://learn.microsoft.com/en-us/cpp/c-runtime-library/exit-success-exit-failure?view=msvc-170).
2023-10-06Auto merge of #101150 - jethrogb:jb/cleanup-sgx-user-memory-copies, ↵bors-122/+85
r=workingjubilee Clean up SGX user memory copies Follow-up on #98126 and #100383 r? `@cuviper` cc `@raoulstrackx`
2023-10-06Remove libcChris Denton-13/+18
We don't use much libc on Windows.
2023-10-05Add more diagnostic items for clippyJason Newcomb-0/+10
2023-10-04Disable CFI for core and std CFI violationsRamon de C Valle-12/+33
Works around #115199 by temporarily disabling CFI for core and std CFI violations to allow the user rebuild and use both core and std with CFI enabled using the Cargo build-std feature.
2023-10-04std: abort instead of panicking if the global allocator uses TLSjoboet-5/+21
2023-10-04Rollup merge of #116146 - Milo123459:milo/clarify-arg-documentation, r=thomccMatthias Krüger-2/+2
Clarify `arg` and `args` documentation Fixes #95400
2023-10-04Rollup merge of #115961 - Kriskras99:master, r=thomccMatthias Krüger-2/+2
Replace 'mutex' with 'lock' in RwLock documentation When copying the documentation for `clear_poison` from Mutex, not every occurence of 'mutex' was replaced with 'lock'.
2023-10-03Bump version placeholdersMark Rousskov-14/+14
2023-10-03std: panic when the global allocator tries to register a TLS destructorjoboet-29/+29
2023-10-03Auto merge of #105394 - Patiga:improve-udpsocket-docs, r=workingjubileebors-1/+20
Improve UdpSocket documentation I tried working with `UdpSocket` and ran into `EINVAL` errors with no clear indication of what causes the error. Also, it was uncharacteristically hard to figure this module out, compared to other Rust `std` modules. 1. `send` and `send_to` return a `usize` This one is just clarity. Usually, returned `usize`s indicate that the buffer might have only been sent partially. This is not the case with UDP. Since that `usize` must always be `buffer.len()`, I have documented that. 2. `bind` limits `connect` and `send_to` When you bind to a limited address space like localhost, you can only `connect` to addresses in that same address space. Error kind: `AddrNotAvailable`. 3. `connect`ing to localhost locks you to localhost On Linux, if you first `connect` to localhost, subsequent `connect`s to non-localhost addresses fail. Error kind: `InvalidInput`. For debugging the third one, it was really hard to find someone else who already had that problem. I only managed to find this thread: https://www.mail-archive.com/netdev@vger.kernel.org/msg159519.html
2023-10-03Rollup merge of #116282 - rustaceanclub:master, r=davidtwcoMatthias Krüger-1/+1
Fix broken links The previous address is no longer available, replace it with the latest available one.
2023-10-02Invoke `backtrace-rs` buildscript in `std` buildscriptPeter Jaszkowiak-0/+12
Based on #99883 by @Arc-blroth Depends on rust-lang/backtrace-rs#556 and rust-lang/cc-rs#705
2023-10-02Rollup merge of #116289 - linkmauve:patch-1, r=the8472Tyler Mandry-0/+1
Add missing #[inline] on AsFd impl for sys::unix::fs::File This operation should be extremely cheap, at most the `mov` of the underlying file descriptor, but due to this missing `#[inline]` it is currently a function call.
2023-10-02Auto merge of #116207 - Ayush1325:uefi_stdio, r=Mark-Simulacrumbors-2/+163
Stdio support for UEFI - Uses Simple Text Output Protocol and Simple Text Input Protocol - Reading is done one character at a time - Writing is done with max 4096 characters # Quirks ## Output Newline - UEFI uses CRLF for newline. So when running the application in UEFI shell (qemu VGA), the output of `println` looks weird. - However, since the UEFI shell supports piping output, I am unsure if doing any output post-processing is a good idea. UEFI shell `cat` command seems to work fine with just LF. ## Input Newline - `Stdin.read_line()` method is broken in UEFI shell. Pressing enter seems to be read as CR, which means LF is never encountered. - Works fine with input redirection from file. CC `@dvdhrm`
2023-10-02Stdio for UEFIAyush Singh-2/+163
- Uses Simple Text Output Protocol and Simple Text Input Protocol - Reading is done one character at a time - Writing is done with max 4096 characters Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
2023-09-30Auto merge of #116157 - the8472:doc-monotonoic-suspend, r=Mark-Simulacrumbors-0/+2
Document that Instant may or may not include system-suspend time Since people are still occasionally surprised by this let's make it more explicit. This doesn't add any new guarantees, only documents the status quo. Related issues: #87906 #79462
2023-09-30Add missing #[inline] on AsFd impl for sys::unix::fs::Filelinkmauve-0/+1
This operation should be extremely cheap, at most the mov of the underlying file descriptor, but due to this missing #[inline] it is currently a function call.
2023-09-30Fix broken linkscui fliter-1/+1
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-09-28time: use clock_gettime on macosTamir Duberstein-150/+45
Replace `mach_{absolute_time,timebase_info}` with `clock_gettime(CLOCK_REALTIME)` on: ``` all(target_os = "macos", not(target_arch = "aarch64")), target_os = "ios", target_os = "watchos", target_os = "tvos" ))] ``` `mach_{absolute_time,timebase_info}` were first used in https://github.com/time-rs/time/commit/cc367edd953e72756ed6f0980918795c11e469b1 which predated the introduction of `clock_gettime` support in macOS 10.12 Sierra which became the minimum supported version in 58bbca958d917a89124da248735926f86c59a149. Note that this change was made for aarch64 in 5008a317ce8e508c390ed12bff281f307313376e which predated 10.12 becoming the minimum supported version. The discussion took place in https://github.com/rust-lang/rust/issues/91417 and in particular https://github.com/rust-lang/rust/issues/91417#issuecomment-992151582 and https://github.com/rust-lang/rust/issues/91417#issuecomment-1033048064 are relevant.
2023-09-28time: use clock_gettime on macosTamir Duberstein-51/+36
Replace `gettimeofday` with `clock_gettime(CLOCK_REALTIME)` on: ``` all(target_os = "macos", not(target_arch = "aarch64")), target_os = "ios", target_os = "watchos", target_os = "tvos" ))] ``` `gettimeofday` was first used in https://github.com/time-rs/time/commit/cc367edd953e72756ed6f0980918795c11e469b1 which predated the introduction of `clock_gettime` support in macOS 10.12 Sierra which became the minimum supported version in 58bbca958d917a89124da248735926f86c59a149.
2023-09-28time: cfg(any(x)) is the same as cfg(x)Tamir Duberstein-2/+2
This was left over in c043a0e7d6f347f9b2c7f08c5b3a179470e0f0c5.
2023-09-28Auto merge of #114882 - ChrisDenton:riddle-me, r=dtolnaybors-125/+116
Update windows ffi bindings Bump `windows-bindgen` to version 0.51.1. This brings with it some changes to the generated FFI bindings, but little that affects the code. One change that does have more of an impact is `SOCKET` being `usize` instead of either `u64` or `u32` (as is used in std's public `SOCKET` type). However, it's now easy enough to abstract over that difference. Finally I added a few new bindings that are likely to be used in pending PRs, mostly to make sure they're ok with the new metadata. r? libs
2023-09-28Auto merge of #114428 - ChaiTRex:master, r=dtolnaybors-3/+3
Convert `Into<ExitStatus> for ExitStatusError` to `From<ExitStatusError> for ExitStatus` in `std::process` Implementing suggestion from https://github.com/rust-lang/rust/issues/84908#issuecomment-912352902: > I believe the impl on ExitStatusError should be > > ```rust > impl From<ExitStatusError> for ExitStatus > ``` > > rather than > > ```rust > impl Into<ExitStatus> for ExitStatusError > ``` > > (there is generally never anything implemented as `Into` first, because implementing `From` reflexively provides `Into`)
2023-09-28Auto merge of #98704 - vthib:impl-from-raw-for-childstd-structs, r=dtolnaybors-2/+95
Implement From<OwnedFd/Handle> for ChildStdin/out/err object ## Summary Comments in `library/std/src/process.rs` ( https://github.com/rust-lang/rust/commit/ab08639e5950f5c8a42a2870c9636181308c3686 ) indicates that `ChildStdin`, `ChildStdout`, `ChildStderr` implements some traits that are not actually implemented: `FromRawFd`, `FromRawHandle`, and the `From<OwnedFd>/From<OwnedHandle>` from the io_safety feature. In this PR I implement `FromRawHandle` and `FromRawFd` for those 3 objects. ## Usecase I have a usecase where those implementations are basically needed. I want to customize in the `Command::spawn` API how the pipes for the parent/child communications are created (mainly to strengthen the security attributes on them). I can properly setup the pipes, and the "child" handles can be provided to `Child::spawn` easily using `Stdio::from_raw_handle`. However, there is no way to generate the `ChildStd*` objects from the raw handle of the created name pipe, which would be very useful to still expose the same API than in other OS (basically a `spawn(...) -> (Child, ChildStdin, ChildStdout, ChildSterr)`, where on windows this is customized), and to for example use `tokio::ChildStdin::from_std` afterwards. ## Questions * Are those impls OK to add? I have searched to see if those impls were missing on purpose, or if it was just never implemented because never needed. I haven't found any indication on why they couldn't be added, although the user clearly has to be very careful that the handle provided makes sense (i think, mainly that it is in overlapped mode for windows). * If this change is ok, adding the impls for the io_safety feature would probably be best, or should it be done in another PR? * I just copy-pasted the `#[stable(...)]` attributes, but the `since` value has to be updated, I'm not sure to which value.
2023-09-28Rollup merge of #115535 - tshepang:patch-2, r=dtolnayMatthias Krüger-71/+69
format doc-comment code examples in std::process
2023-09-28Update stability attribute for child stream From implsDavid Tolnay-6/+6
2023-09-26std: broaden the allowed behaviour for recursive TLS initializationjoboet-3/+3
2023-09-25Auto merge of #116070 - eduardosm:IoSlice-advance_slices-checked_add, ↵bors-16/+19
r=Mark-Simulacrum Avoid overflow in `IoSlice::advance_slices` Noticed in https://github.com/rust-lang/rust/issues/62726#issuecomment-1713997431.
2023-09-25Document that Instant may or may not include system-suspend timeThe 8472-0/+2
2023-09-25update other placeMilo-1/+1
2023-09-25clarify documentation about variable substituionMilo-1/+1
2023-09-25Auto merge of #116057 - RalfJung:io-safety, r=Mark-Simulacrumbors-8/+14
fix OS-specific I/O safety docs since the io_safety feature is stable Looks like this text was forgotten to be updated when `io_safety` got stabilized: it still says "once the io_safety feature is stable". Also adjust the wording a bit for how these docs relate to the general concept of I/O safety.
2023-09-24Auto merge of #105861 - Ayush1325:uefi-std-minimial, r=workingjubileebors-6/+827
Add Minimal Std implementation for UEFI # Implemented modules: 1. alloc 2. os_str 3. env 4. math # Related Links Tracking Issue: https://github.com/rust-lang/rust/issues/100499 API Change Proposal: https://github.com/rust-lang/libs-team/issues/87 # Additional Information This was originally part of https://github.com/rust-lang/rust/pull/100316. Since that PR was becoming too unwieldy and cluttered, and with suggestion from `@dvdhrm,` I have extracted a minimal std implementation to this PR. The example in `src/doc/rustc/src/platform-support/unknown-uefi.md` has been tested for `x86_64-unknown-uefi` and `i686-unknown-uefi` in OVMF. It would be great if someone more familiar with AARCH64 can help with testing for that target. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>