about summary refs log tree commit diff
path: root/library/std
AgeCommit message (Collapse)AuthorLines
2024-10-14Fix two const-hacksGeorge Bateman-15/+4
2024-10-14uefi: Implement getcwd and chdirAyush Singh-14/+73
- Using EFI Shell Protocol. These functions do not make much sense unless a shell is present. - Return the exe dir in case shell protocol is missing. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2024-10-14Rollup merge of #131616 - RalfJung:const_ip, r=tgross35Matthias Krüger-3/+0
merge const_ipv4 / const_ipv6 feature gate into 'ip' feature gate https://github.com/rust-lang/rust/issues/76205 has been closed a while ago, but there are still some functions that reference it. Those functions are all unstable *and* const-unstable. There's no good reason to use a separate feature gate for their const-stability, so this PR moves their const-stability under the same gate as their regular stability, and therefore removes the remaining references to https://github.com/rust-lang/rust/issues/76205.
2024-10-14Rollup merge of #128967 - devnexen:get_path_fbsd_upd, r=joboetMatthias Krüger-3/+3
std::fs::get_path freebsd update. what matters is we re doing the right things as doing sizeof, rather than passing KINFO_FILE_SIZE (only defined on intel architectures), the kernel making sure it matches the expectation in its side.
2024-10-13Implement file_lock featureChristopher Berner-0/+511
This adds lock(), lock_shared(), try_lock(), try_lock_shared(), and unlock() to File gated behind the file_lock feature flag
2024-10-13Rollup merge of #131646 - RalfJung:unix-miri-fallbacks, r=joboetMatthias Krüger-1/+2
sys/unix: add comments for some Miri fallbacks
2024-10-13library: xous: mark alloc as `FIXME(static_mut_refs)`Sean Cross-0/+3
The allocator on Xous is now throwing warnings because the allocator needs to be mutable, and allocators hand out mutable pointers, which the `static_mut_refs` lint now catches. Give the same treatment to Xous as wasm, at least until a solution is devised for fixing the warning on wasm. Signed-off-by: Sean Cross <sean@xobs.io>
2024-10-13xous: ffi: correct syscall number for adjust_processSean Cross-1/+1
The AdjustProcessLimit syscall was using the correct call number. Signed-off-by: Sean Cross <sean@xobs.io>
2024-10-13net: fix dead code warningSean Cross-0/+3
Signed-off-by: Sean Cross <sean@xobs.io>
2024-10-13std: xous: add support for args and envSean Cross-32/+504
Process arguments and environment variables are both passed by way of Application Parameters. These are a TLV format that gets passed in as the second process argument. This patch combines both as they are very similar in their decode. Signed-off-by: Sean Cross <sean@osdyne.com>
2024-10-13sys/unix: add comments for some Miri fallbacksRalf Jung-1/+2
2024-10-13remove outdated comment now that Miri is on CIRalf Jung-1/+0
2024-10-13sys/windows: remove miri hack that is only needed for win7Ralf Jung-7/+3
2024-10-13merge const_ipv4 / const_ipv6 feature gate into 'ip' feature gateRalf Jung-3/+0
2024-10-12Rollup merge of #131503 - theemathas:stdin_read_line_docs, r=Mark-SimulacrumMatthias Krüger-1/+6
More clearly document Stdin::read_line These are common pitfalls for beginners, so I think it's worth making the subtleties more visible.
2024-10-12Rollup merge of #131233 - joboet:stdout-before-main, r=tgross35Trevor Gross-23/+42
std: fix stdout-before-main Fixes #130210. Since #124881, `ReentrantLock` uses `ThreadId` to identify threads. This has the unfortunate consequence of breaking uses of `Stdout` before main: Locking the `ReentrantLock` that synchronizes the output will initialize the thread ID before the handle for the main thread is set in `rt::init`. But since that would overwrite the current thread ID, `thread::set_current` triggers an abort. This PR fixes the problem by using the already initialized thread ID for constructing the main thread handle and allowing `set_current` calls that do not change the thread's ID.
2024-10-12std: fix stdout-before-mainjoboet-23/+42
Fixes #130210. Since #124881, `ReentrantLock` uses `ThreadId` to identify threads. This has the unfortunate consequence of breaking uses of `Stdout` before main: Locking the `ReentrantLock` that synchronizes the output will initialize the thread ID before the handle for the main thread is set in `rt::init`. But since that would overwrite the current thread ID, `thread::set_current` triggers an abort. This PR fixes the problem by using the already initialized thread ID for constructing the main thread handle and allowing `set_current` calls that do not change the thread's ID.
2024-10-11Rollup merge of #130962 - nyurik:opts-libs, r=cuviperTrevor Gross-11/+11
Migrate lib's `&Option<T>` into `Option<&T>` Trying out my new lint https://github.com/rust-lang/rust-clippy/pull/13336 - according to the [video](https://www.youtube.com/watch?v=6c7pZYP_iIE), this could lead to some performance and memory optimizations. Basic thoughts expressed in the video that seem to make sense: * `&Option<T>` in an API breaks encapsulation: * caller must own T and move it into an Option to call with it * if returned, the owner must store it as Option<T> internally in order to return it * Performance is subject to compiler optimization, but at the basics, `&Option<T>` points to memory that has `presence` flag + value, whereas `Option<&T>` by specification is always optimized to a single pointer.
2024-10-11Single commit implementing the enzyme/autodiff frontendManuel Drehwald-1/+8
Co-authored-by: Lorenz Schmidt <bytesnake@mailbox.org>
2024-10-10uefi: process: Add args supportAyush Singh-12/+56
- Wrap all args with quotes. - Escape ^ and " inside quotes using ^. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2024-10-10Use with_capacity(0) because we're reading the capacity later onMads Marquart-1/+1
2024-10-10Prefer `target_vendor = "apple"` on confstrMads Marquart-3/+3
2024-10-10use `confstr(_CS_DARWIN_USER_TEMP_DIR, ...)` as a `TMPDIR` fallback on darwinThom Chiovoloni-7/+109
2024-10-10More clearly document Stdin::read_lineTim (Theemathas) Chirananthavat-1/+6
These are common pitfalls for beginners, so I think it's worth making the subtleties more visible.
2024-10-10rustc_target: Add sme-b16b16 as an explicit aarch64 target featureKajetan Puchalski-0/+1
LLVM 20 split out what used to be called b16b16 and correspond to aarch64 FEAT_SVE_B16B16 into sve-b16b16 and sme-b16b16. Add sme-b16b16 as an explicit feature and update the codegen accordingly.
2024-10-09Rollup merge of #131462 - cuviper:open_buffered-error, r=RalfJungMatthias Krüger-1/+2
Mention allocation errors for `open_buffered` This documents that `File::open_buffered` may return an error on allocation failure.
2024-10-09Rollup merge of #131449 - nickrum:wasip2-net-decouple-fd, r=alexcrichtonMatthias Krüger-18/+58
Decouple WASIp2 sockets from WasiFd This is a follow up to #129638, decoupling WASIp2's socket implementation from WASIp1's `WasiFd` as discussed with `@alexcrichton.` Quite a few trait implementations in `std::os::fd` rely on the fact that there is an additional layer of abstraction between `Socket` and `OwnedFd`. I thus had to add a thin `WasiSocket` wrapper struct that just "forwards" to `OwnedFd`. Alternatively, I could have added a lot of conditional compilation to `std::os::fd`, which feels even worse. Since `WasiFd::sock_accept` is no longer accessible from `TcpListener` and since WASIp2 has proper support for accepting sockets through `Socket::accept`, the `std::os::wasi::net` module has been removed from WASIp2, which only contains a single `TcpListenerExt` trait with a `sock_accept` method as well as an implementation for `TcpListener`. Let me know if this is an acceptable solution.
2024-10-09Rollup merge of #130827 - fmease:library-mv-obj-save-dyn-compat, r=ibraheemdevMatthias Krüger-1/+3
Library: Rename "object safe" to "dyn compatible" Completed T-lang FCP: https://github.com/rust-lang/lang-team/issues/286#issuecomment-2338905118. Tracking issue: https://github.com/rust-lang/rust/issues/130852 Regarding https://github.com/rust-lang/rust/labels/relnotes, I guess I will manually open a https://github.com/rust-lang/rust/labels/relnotes-tracking-issue since this change affects everything (compiler, library, tools, docs, books, everyday language). r? ghost
2024-10-09Mention allocation errors for `open_buffered`Josh Stone-1/+2
2024-10-09Library: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-1/+3
2024-10-09Decouple WASIp2 sockets from WasiFdNicola Krumschmidt-18/+58
2024-10-08Update library/std/src/sys/pal/unix/process/process_vxworks.rsYuri Astrakhan-1/+1
Co-authored-by: Josh Stone <cuviper@gmail.com>
2024-10-08fix ref in process_vxworks.rsYuri Astrakhan-1/+1
2024-10-08Update library/std/src/sys/pal/unix/process/process_unix.rsYuri Astrakhan-1/+1
Co-authored-by: Josh Stone <cuviper@gmail.com>
2024-10-08Change a few `&Option<T>` into `Option<&T>`Yuri Astrakhan-10/+10
2024-10-07Rollup merge of #131308 - mati865:gnullvm-f16-f128, r=tgross35Stuart Cook-2/+3
enable f16 and f128 on windows-gnullvm targets Continuation of https://github.com/rust-lang/rust/pull/130959
2024-10-06Rollup merge of #131307 - YohDeadfall:prctl-set-name-dbg-assert, ↵Matthias Krüger-1/+3
r=workingjubilee Android: Debug assertion after setting thread name While `prctl` cannot fail if it points to a valid buffer, it's still better to assert the result as it's done for other places.
2024-10-05Update `compiler-builtins` to 0.1.133Trevor Gross-1/+1
This includes [1], which should help resolve an infinite recusion issue on WASM and SPARC (possibly other platforms). See [2] and [3] for further details. [1]: https://github.com/rust-lang/compiler-builtins/pull/708 [2]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/sparc-unknown-none-elf.20regresssion.20between.20compiler-built.2E.2E.2E [3]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.5Bwasm32.5D.20Infinite.20recursion.20.60compiler-builtins.60.20.60__multi3.60
2024-10-05enable f16 and f128 on windows-gnullvm targetsMateusz Mikuła-2/+3
2024-10-05Unbreak tidyPavel Grigorenko-5/+5
2024-10-05Stabilize `std::io::ErrorKind::QuotaExceeded`Pavel Grigorenko-9/+9
Also drop "Filesystem" from its name
2024-10-05Android: Debug assertion after setting thread nameYoh Deadfall-1/+3
2024-10-05Auto merge of #131221 - XrXr:bump-compiler-builtins, r=tgross35bors-1/+1
Update compiler-builtins to 0.1.132 This commit updates compiler-builtins from 0.1.130 to 0.1.132. PRs in the delta: - rust-lang/compiler-builtins#698 - rust-lang/compiler-builtins#699 - rust-lang/compiler-builtins#701 - rust-lang/compiler-builtins#704 - rust-lang/compiler-builtins#627 - rust-lang/compiler-builtins#706
2024-10-05Rollup merge of #131094 - joboet:lazy_once_box, r=ibraheemdevMatthias Krüger-284/+185
std: replace `LazyBox` with `OnceBox` This PR replaces the `LazyBox` wrapper used to allocate the pthread primitives with `OnceBox`, which has a more familiar API mirroring that of `OnceLock`. This cleans up the code in preparation for larger changes like #128184 (from which this PR was split) and allows some neat optimizations, like avoid an acquire-load of the allocation pointer in `Mutex::unlock`, where the initialization of the allocation must have already been observed. Additionally, I've gotten rid of the TEEOS `Condvar` code, it's just a duplicate of the pthread one anyway and I didn't want to repeat myself.
2024-10-04Update compiler-builtins to 0.1.132Alan Wu-1/+1
This commit updates compiler-builtins from 0.1.130 to 0.1.132. PRs in the delta: - rust-lang/compiler-builtins#698 - rust-lang/compiler-builtins#699 - rust-lang/compiler-builtins#701 - rust-lang/compiler-builtins#704 - rust-lang/compiler-builtins#627 - rust-lang/compiler-builtins#706
2024-10-04Stabilize `BufRead::skip_until`okaneco-3/+1
2024-10-03update libc versionDavid Carlier-1/+1
2024-10-03std::fs::get_path freebsd update.David Carlier-2/+2
what matters is we re doing the right things as doing sizeof, rather than KINFO_FILE_SIZE (only defined on intel architectures), the kernel making sure it matches the expectation in its side.
2024-10-03Rollup merge of #131163 - JakenHerman:master, r=NadrierilMatthias Krüger-0/+1
Add `get_line` confusable to `Stdin::read_line()` This pull request resolves https://github.com/rust-lang/rust/issues/131091 --- I've updated tests for `tests/ui/attributes/rustc_confusables_std_cases` in order to verify this change is working as intended. Before I submitted this pull request, I had a pull request to my local fork. If you're interested in seeing the conversation on that PR, go to https://github.com/JakenHerman/rust/pull/1. --- **Testing**: Run `./x.py test tests/ui/attributes/rustc_confusables_std_cases.rs`
2024-10-03Auto merge of #128711 - clarfonthey:default-iters-hash, r=dtolnaybors-0/+80
impl `Default` for `HashMap`/`HashSet` iterators that don't already have it This is a follow-up to #128261 that isn't included in that PR because it depends on: * [x] rust-lang/hashbrown#542 (`Default`) * [x] `hashbrown` release containing above It also wasn't included in #128261 initially and should have its own FCP, since these are also insta-stable. Changes added: * `Default for hash_map::{Iter, IterMut, IntoIter, IntoKeys, IntoValues, Keys, Values, ValuesMut}` * `Default for hash_set::{Iter, IntoIter}` Changes that were added before FCP, but are being deferred to later: * `Clone for hash_map::{IntoIter, IntoKeys, IntoValues} where K: Clone, V: Clone` * `Clone for hash_set::IntoIter where K: Clone`