about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2024-02-24Rollup merge of #121530 - wgslr:master, r=Mark-SimulacrumMatthias Krüger-1/+1
Fix incorrect doc of ScopedJoinHandle::is_finished Fixes the explanation how to use `is_finished` to achieve a non-blocking join. The updated version matches the documentation of the non-scoped JoinHandle::is_finished.
2024-02-24library: use `addr_of!`Pavel Grigorenko-62/+70
2024-02-23Apply suggestions from code reviewzachs18-3/+3
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2024-02-24Fix incorrect doc of ScopedJoinHandle::is_finishedWojciech Geisler-1/+1
Fixes the explanation how to use is_finished to achieve a non-blocking join. The updated version matches the documentation of the non-scoped JoinHandle::is_finished.
2024-02-23Auto merge of #119536 - Jules-Bertholet:const-barrier, r=dtolnaybors-1/+3
Make `Barrier::new()` const I guess this was just missed in #97791? `@rustbot` label T-libs-api -T-libs
2024-02-23std: make `ReentrantLock` publicjoboet-207/+375
2024-02-23Auto merge of #121303 - GrigorenkoPV:static_mut_refs, r=oli-obk,RalfJungbors-5/+0
Get rid of some `#![allow(static_mut_refs)]`
2024-02-23Auto merge of #121514 - matthiaskrgr:rollup-5f0vhv7, r=matthiaskrgrbors-2/+2
Rollup of 6 pull requests Successful merges: - #120742 (mark `min_exhaustive_patterns` as complete) - #121470 (Don't ICE on anonymous struct in enum variant) - #121492 (coverage: Rename `is_closure` to `is_hole`) - #121495 (remove repetitive words) - #121498 (Make QNX/NTO specific "timespec capping" public to crate::sys) - #121510 (lint-overflowing-ops: unify cases and remove redundancy) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-23moved tests fileNikitaShyrei-0/+0
2024-02-23Get rid of some `#[allow(static_mut_refs)]`Pavel Grigorenko-5/+0
2024-02-23Auto merge of #121454 - reitermarkus:generic-nonzero-library, r=dtolnaybors-12/+12
Use generic `NonZero` everywhere in `library`. Tracking issue: https://github.com/rust-lang/rust/issues/120257 Use generic `NonZero` everywhere (except stable examples). r? `@dtolnay`
2024-02-23Make timespec capping public to crate::sysFlorian Bartels-2/+2
It is used in: - `library/std/src/sys/locks/condvar/pthread.rs` - `library/std/src/sys/pal/unix/thread_parking/pthread.rs`
2024-02-22std support for wasm32 panic=unwindNoa-4/+4
2024-02-22Add `rustc_confusables` annotations to some stdlib APIsEsteban Küber-0/+9
Help with common API confusion, like asking for `push` when the data structure really has `append`. ``` error[E0599]: no method named `size` found for struct `Vec<{integer}>` in the current scope --> $DIR/rustc_confusables_std_cases.rs:17:7 | LL | x.size(); | ^^^^ | help: you might have meant to use `len` | LL | x.len(); | ~~~ help: there is a method with a similar name | LL | x.resize(); | ~~~~~~ ``` #59450
2024-02-22Use generic `NonZero` everywhere in `std`.Markus Reiter-12/+12
2024-02-22remove potentially misleading sentence about libc::accessMarc Schoolderman-2/+1
2024-02-22Add std::ffi::c_str modulesltdk-6/+46
2024-02-22Auto merge of #117174 - Ayush1325:uefi-stdio-improve, r=workingjubileebors-37/+94
Improve UEFI stdio Fixed some things suggested in last PR: #116207 cc `@dvdhrm` cc `@nicholasbishop`
2024-02-21Always use WaitOnAddress on Win10+Chris Denton-106/+154
2024-02-21os::net: expanding TcpStreamExt for Linux with `tcp_deferaccept`.David Carlier-0/+93
allows for socket to process only when there is data to process, the option sets a number of seconds until the data is ready.
2024-02-21rename ptr::invalid -> ptr::without_provenanceRalf Jung-27/+44
also introduce ptr::dangling matching NonNull::dangling
2024-02-21Remove unnecessary map_errKornel-9/+9
2024-02-21TryReserveError to ErrorKind::OutOfMemoryKornel-0/+22
2024-02-20Stabilize `LazyCell` and `LazyLock` (`lazy_cell`)Peter Jaszkowiak-20/+24
2024-05-25Rollup merge of #125527 - programmerjake:patch-2, r=workingjubileeMatthias Krüger-0/+3
Add manual Sync impl for ReentrantLockGuard Fixes: #125526 Tracking Issue: #121440 this impl is even shown in the summary in the tracking issue, but apparently was forgotten in the actual implementation
2024-05-25Rollup merge of #125271 - RalfJung:posix_memalign, r=workingjubileeMatthias Krüger-9/+7
use posix_memalign on almost all Unix targets Seems nice to be able to use a single common codepath for all of them. :) The `libc` crate says this symbol exists for all Unix targets. I did locally do check-builds to ensure this still builds, but I can't really test more than that. - For redox, I found indications posix_memalign really exists [here](https://gitlab.redox-os.org/redox-os/relibc/-/merge_requests/271) - For esp-idf, I found indications [here](https://github.com/playable-tech/esp-idf/commit/c5b297a86f3d65081bc690e81ab53db47b18d31c) - ~~For horizon and vita (these seem to be gaming console OSes? "Horizon OS" also has some hits for a Facebook product but that seems unrelated), they seem to be based on "newlib", where posix_memalign [seems to exist](https://sourceware.org/git/?p=newlib-cygwin.git;a=commitdiff;h=3ba2c39fb2a12cd7332ef16b1b3e3df994f7c6f5).~~ Turns out no, this 20-year-old standard POSIX function is unfortunately [not supported](https://github.com/rust-lang/rust/pull/125271#issuecomment-2119221419) here.
2024-05-24Add manual Sync impl for ReentrantLockGuardJacob Lifshay-0/+3
Fixes: #125526
2024-05-19fix typoRalf Jung-2/+2
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2024-05-19use posix_memalign on most Unix targetsRalf Jung-9/+7
2024-02-20Delete architecture-specific memchr code in std::sysArthur Carcano-231/+8
Currently all architecture-specific memchr code is only used in `std::io`. Most of the actual `memchr` capacity exposed to the user through the slice API is instead implemented in core::slice::memchr. Hence this commit deletes memchr from std::sys[_common] and replace calls to it by calls to core::slice::memchr functions. This deletes (r)memchr from the list of symbols linked to libc.
2024-02-20Rollup merge of #121310 - GrigorenkoPV:doc-smallfix, r=NilstriebNilstrieb-4/+2
Remove an old hack for rustdoc Since #78696 has been resolved
2024-02-19Remove an old hack for rustdocPavel Grigorenko-4/+2
2024-02-19Auto merge of #121177 - joboet:move_pal_locks, r=ChrisDentonbors-164/+141
Move locks to `sys` Part of #117276. r? `@ChrisDenton`
2024-02-19Rollup merge of #121041 - Nilstrieb:into-the-future-of-2024, r=Mark-SimulacrumMatthias Krüger-3/+3
Add `Future` and `IntoFuture` to the 2024 prelude Implements rust-lang/rfcs#3509.
2024-02-19Auto merge of #105917 - a1phyr:read_chain_more_impls, r=workingjubileebors-3/+66
Specialize some methods of `io::Chain` This PR specializes the implementation of some methods of `io::Chain`, which could bring performance improvements when using it.
2024-02-18Auto merge of #121101 - GnomedDev:dyn-small-c-string, r=Nilstriebbors-58/+61
Reduce monomorphisation bloat in small_c_string This is a code path usually next to an FFI call, so taking the `dyn` slowdown for the 1159 llvm-line (fat lto, codegen-units 1, release build) drop in my testing program [t2fanrd](https://github.com/GnomedDev/t2fanrd) is worth it imo.
2024-02-18Add `Future` and `IntoFuture` to the 2024 preludeNilstrieb-3/+3
Implements RFC 3509.
2024-02-18Dyn erase at call siteDavid Thomas-60/+51
2024-02-18Add some comments to prevent regressionDavid Thomas-0/+5
2024-02-18Reduce monomorphisation bloat in small_c_stringDavid Thomas-8/+15
2024-02-18Rollup merge of #121266 - SabrinaJewson:easy-syscall-aliases, r=Mark-SimulacrumMatthias Krüger-3/+32
Add uncontroversial syscall doc aliases to std docs This PR contains the parts of #113891 that don’t break the doc alias policy. r? `@Mark-Simulacrum`
2024-02-18Rollup merge of #118569 - blyxxyz:platform-os-str-slice, r=Mark-SimulacrumMatthias Krüger-47/+219
Move `OsStr::slice_encoded_bytes` validation to platform modules This delegates OS string slicing (`OsStr::slice_encoded_bytes`) validation to the underlying platform implementation. For now that results in increased performance and better error messages on Windows without any changes to semantics. In the future we may want to provide different semantics for different platforms. The existing implementation is still used on Unix and most other platforms and is now optimized a little better. Tracking issue: https://github.com/rust-lang/rust/issues/118485 cc `@epage,` `@BurntSushi`
2024-02-18Add uncontroversial syscall doc aliases to std docsSabrinaJewson-3/+32
2024-02-18Auto merge of #117772 - surechen:for_117448, r=petrochenkovbors-1/+0
Tracking import use types for more accurate redundant import checking fixes #117448 By tracking import use types to check whether it is scope uses or the other situations like module-relative uses, we can do more accurate redundant import checking. For example unnecessary imports in std::prelude that can be eliminated: ```rust use std::option::Option::Some;//~ WARNING the item `Some` is imported redundantly use std::option::Option::None; //~ WARNING the item `None` is imported redundantly ```
2024-02-18By tracking import use types to check whether it is scope uses or the other ↵surechen-1/+0
situations like module-relative uses, we can do more accurate redundant import checking. fixes #117448 For example unnecessary imports in std::prelude that can be eliminated: ```rust use std::option::Option::Some;//~ WARNING the item `Some` is imported redundantly use std::option::Option::None; //~ WARNING the item `None` is imported redundantly ```
2024-02-18Improve wording of static_mut_refObei Sideg-8/+11
Rename `static_mut_ref` lint to `static_mut_refs`.
2024-02-17Rollup merge of #119032 - smmalis37:patch-1, r=ChrisDentonGuillaume Boisseau-5/+25
Use a hardcoded constant instead of calling OpenProcessToken. Now that Win 7 support is dropped, we can resurrect #90144. GetCurrentProcessToken is defined in processthreadsapi.h as: FORCEINLINE HANDLE GetCurrentProcessToken ( VOID ) { return (HANDLE)(LONG_PTR) -4; } Since it's very unlikely that this constant will ever change, let's just use it instead of making calls to get the same information.
2024-02-17Auto merge of #120741 - a1phyr:safe_buffer_advance, r=m-ou-sebors-21/+13
Make `io::BorrowedCursor::advance` safe This also keeps the old `advance` method under `advance_unchecked` name. This makes pattern like `std::io::default_read_buf` safe to write.
2024-02-16Remove cfg_attrSteven-1/+0
2024-02-16Use a hardcoded constant instead of calling OpenProcessToken.Steven-5/+26
Now that Win 7 support is dropped, we can resurrect #90144. GetCurrentProcessToken is defined in processthreadsapi.h as: FORCEINLINE HANDLE GetCurrentProcessToken ( VOID ) { return (HANDLE)(LONG_PTR) -4; } Since it's very unlikely that this constant will ever change, let's just use it instead of making calls to get the same information.