about summary refs log tree commit diff
path: root/library/std
AgeCommit message (Collapse)AuthorLines
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 #125498 - zmodem:avx512er, r=workingjubileeMatthias Krüger-2/+0
Stop using the avx512er and avx512pf x86 target features They are no longer supported by LLVM 19. Fixes #125492
2024-05-25Rollup merge of #125478 - Urgau:check-cfg-config-bump-stage0, r=Mark-SimulacrumMatthias Krüger-1/+0
Bump bootstrap compiler to the latest beta compiler This PR updates the bootstrap compiler, aka stage0 to the latest beta version, since it contains rust-lang/cargo#13925. It removes those unconditional Cargo warnings: ``` warning: [...]/rust/library/core/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg warning: [...]/rust/library/std/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg warning: [...]/rust/library/alloc/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg ``` for all contributors/users of this repository (including CI). I don't know if that's something we do, or if it's even advisable, feel free to close. r? `@Mark-Simulacrum`
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-24Stop using the avx512er and avx512pf x86 target featuresHans Wennborg-2/+0
They are no longer supported by LLVM 19. Fixes #125492
2024-05-24Remove now outdated comment since we bumped stage0Urgau-1/+0
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.
2024-02-16Auto merge of #120538 - kornelski:read-not-exact, r=m-ou-sebors-2/+2
Make File::read_to_end less special Follow-up to #117925
2024-02-16std: move locks to `sys` on platforms without threadsjoboet-17/+10
2024-02-16std: move locks to `sys` on xousjoboet-10/+11
2024-02-16std: move locks to `sys` on Windowsjoboet-8/+10
2024-02-16std: move locks to `sys` on UNIX and other futex platformsjoboet-218/+55
2024-02-16std: move locks to `sys` on teeosjoboet-10/+158
2024-02-16std: move locks to `sys` on SGXjoboet-23/+19
2024-02-16std: move locks to `sys` on µITRONjoboet-41/+41
2024-02-16Auto merge of #120486 - reitermarkus:use-generic-nonzero, r=dtolnaybors-91/+91
Use generic `NonZero` internally. Tracking issue: https://github.com/rust-lang/rust/issues/120257
2024-02-16Auto merge of #120889 - Ayush1325:uefi-instant, r=joshtriplettbors-0/+120
Implement Instant for UEFI - Uses Timestamp Protocol if present. Else use rdtsc for x86 and x86-64
2024-02-15Update library/std/src/fs.rsHaydon Ryan-2/+2
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2024-02-15Update library/std/src/fs.rsHaydon Ryan-2/+2
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2024-02-15Rollup merge of #120672 - devnexen:update_thread_stack_guardpages_fbsd, ↵Guillaume Gomez-5/+25
r=m-ou-se std::thread update freebsd stack guard handling. up to now, it had been assumed the stack guard setting default is not touched in the field but some user might just want to disable it or increase it. checking it once at runtime should be enough.
2024-02-15Rollup merge of #121098 - ShoyuVanilla:thread-local-unnecessary-else, ↵Matthias Krüger-1/+2
r=Nilstrieb Remove unnecessary else block from `thread_local!` expanded code Some expanded codes make ["unnecessary else block" warnings](https://github.com/rust-lang/rust-analyzer/issues/16556#issuecomment-1944271716) for Rust Analyzer
2024-02-15Rollup merge of #118749 - ChrisDenton:winsys, r=cuviperMatthias Krüger-9/+10
Make contributing to windows bindings easier This PR does three things: - Automatically sorts bindings so contributors don't have to. I should have done this to begin with but was lazy. - Renames `windows_sys.lst` to `bindings.txt`. This [matches the windows-rs repository](https://github.com/microsoft/windows-rs/blob/8e71051ea8a57594478e585d2740126893f9dbb7/crates/tools/sys/bindings.txt) (and repos that copy it). I believe consistency with other projects helps get people orientated. - Adds a `README.md` file explaining what this is about and how to add bindings. This has the benefit of being directly editable and it's rendered when viewed online. Also people are understandably jumping right into the `windows_sys.rs` file via ripgrep or github search and so missing that it's generated. A `README.md` alongside it is at least slightly more obvious in that case. There is still a small note at the top of `windows_sys` in case people do read from the beginning. None of this has any impact on the actual code generated. It's purely to make the new contributors workflow a bit nicer.