about summary refs log tree commit diff
path: root/library/std/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2024-08-07Rollup merge of #125048 - dingxiangfei2009:stable-deref, r=amanieuMatthias Krüger-0/+1
PinCoerceUnsized trait into core cc ``@Darksonn`` ``@wedsonaf`` ``@ojeda`` This is a PR to introduce a `PinCoerceUnsized` trait in order to make trait impls generated by the proc-macro `#[derive(SmartPointer)]`, proposed by [RFC](https://github.com/rust-lang/rfcs/blob/e17e19ac7ad1c8ccad55d4babfaee1aa107d1da5/text/3621-derive-smart-pointer.md#pincoerceunsized-1), sound. There you may find explanation, justification and discussion about the alternatives. Note that we do not seek stabilization of this `PinCoerceUnsized` trait in the near future. The stabilisation of this trait does not block the eventual stabilization process of the `#[derive(SmartPointer)]` macro. Ideally, use of `DerefPure` is more preferrable except this will actually constitute a breaking change. `PinCoerceUnsized` emerges as a solution to the said soundness hole while avoiding the breaking change. More details on the `DerefPure` option have been described in this [section](https://github.com/rust-lang/rfcs/blob/e17e19ac7ad1c8ccad55d4babfaee1aa107d1da5/text/3621-derive-smart-pointer.md#derefpure) of the RFC linked above. Earlier discussion can be found in this [Zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/Pin.20and.20soundness.20of.20unsizing.20coercions) and [rust-for-linux thread](https://rust-lang.zulipchat.com/#narrow/stream/425075-rust-for-linux/topic/.23.5Bderive.28SmartPointer.29.5D.20and.20pin.20unsoundness.20rfc.233621). try-job: dist-various-2
2024-08-03Rollup merge of #128368 - nnethercote:rustfmt-tweaks, r=cuviperMatthias Krüger-1/+1
Formatting tweaks Some small post-#125443 formatting tweaks. r? ``@cuviper``
2024-08-03Auto merge of #128528 - ↵bors-4/+0
workingjubilee:you-dont-need-to-see-this-cpuid-move-along, r=Amanieu Finish removing `has_cpuid` The one use of it was guaranteed to be always true. try-job: test-various
2024-08-01std: Remove has_cpuidJubilee Young-4/+0
The one use of it was guaranteed to be always true.
2024-08-01DogfoodCaio-0/+1
2024-07-31PinCoerceUnsized trait into coreXiangfei Ding-0/+1
2024-07-30Auto merge of #128083 - Mark-Simulacrum:bump-bootstrap, r=albertlarsan68bors-1/+0
Bump bootstrap compiler to new beta https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2024-07-30Move a comment.Nicholas Nethercote-1/+1
In #125443 this comment ended up in the wrong spot. I'm not sure why; after careful checking this was the only case I could find like this.
2024-07-29impl CloneToUninit for Path and OsStrPavel Grigorenko-0/+1
2024-07-29Rollup merge of #128307 - ojeda:unescaped_backticks, r=GuillaumeGomezMatthias Krüger-0/+1
Clean and enable `rustdoc::unescaped_backticks` for `core/alloc/std/test/proc_macro` I am not sure if the lint is supposed to be "ready enough" (since it is `allow` by default), but it does catch a couple issues in `core` (`alloc`, `std`, `test` and `proc_macro` are already clean), so I propose making it `warn` in all the crates rendered in the website. Cc: `@GuillaumeGomez`
2024-07-29Warn on `rustdoc::unescaped_backticks` for `core/alloc/std/test/proc_macro`Miguel Ojeda-0/+1
They are all clean now, so enable the lint to keep them clean going forward. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-07-29Reformat `use` declarations.Nicholas Nethercote-44/+41
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-28step cfg(bootstrap)Mark Rousskov-1/+0
2024-07-28stabilize const_wakerSlanterns-1/+0
2024-07-24Auto merge of #127153 - NobodyXu:pipe, r=ChrisDentonbors-0/+2
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: #127154 try-job: x86_64-msvc try-job: i686-mingw
2024-07-23Initial implementation of anonymous_pipeJiahao XU-0/+2
Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com> Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com> Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-07-19uefi: process: Fixes from PRAyush Singh-0/+1
- Update system table crc32 - Fix unsound use of Box - Free exit data - Code improvements - Introduce OwnedTable - Update r-efi to latest version - Use extended_varargs_abi_support for install_multiple_protocol_interfaces and uninstall_multiple_protocol_interfaces - Fix comments - Stub out args implementation Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
2024-07-16Rollup merge of #126776 - nnethercote:rustfmt-use-pre-cleanups-2, r=cuviperTrevor Gross-1/+0
Clean up more comments near use declarations #125443 will reformat all use declarations in the repository. There are a few edge cases involving comments on use declarations that require care. This PR fixes them up so #125443 can go ahead with a simple `x fmt --all`. A follow-up to #126717. r? ``@cuviper``
2024-07-17Avoid comments that describe multiple `use` items.Nicholas Nethercote-1/+0
There are some comments describing multiple subsequent `use` items. When the big `use` reformatting happens some of these `use` items will be reordered, possibly moving them away from the comment. With this additional level of formatting it's not really feasible to have comments of this type. This commit removes them in various ways: - merging separate `use` items when appropriate; - inserting blank lines between the comment and the first `use` item; - outright deletion (for comments that are relatively low-value); - adding a separate "top-level" comment. We also entirely skip formatting for four library files that contain nothing but `pub use` re-exports, where reordering would be painful.
2024-07-14std: deny(unsafe_op_in_unsafe_fn) but allow sitesJubilee Young-1/+2
This provides a list of locations to hunt down issues in.
2024-07-04Rollup merge of #126792 - wooden-worm:master, r=Mark-SimulacrumJacob Pratt-0/+1
wasm64 build with target-feature=+simd128,+atomics Fixes https://github.com/rust-lang/rust/issues/126778
2024-07-03Rollup merge of #123588 - tgross35:stabilize-assert_unchecked, r=dtolnayJacob Pratt-1/+0
Stabilize `hint::assert_unchecked` Make the following API stable, including const: ```rust // core::hint, std::hint pub const unsafe fn assert_unchecked(p: bool); ``` This PR also reworks some of the documentation and adds an example. Tracking issue: https://github.com/rust-lang/rust/issues/119131 FCP: https://github.com/rust-lang/rust/issues/119131#issuecomment-1906394087. The docs update should resolve the remaining concern.
2024-07-01Rollup merge of #126732 - StackOverflowExcept1on:master, r=m-ou-seGuillaume Gomez-1/+0
Stabilize `PanicInfo::message()` and `PanicMessage` Resolves #66745 This stabilizes the [`PanicInfo::message()`](https://doc.rust-lang.org/nightly/core/panic/struct.PanicInfo.html#method.message) and [`PanicMessage`](https://doc.rust-lang.org/nightly/core/panic/struct.PanicMessage.html). Demonstration of [custom panic handler](https://github.com/StackOverflowExcept1on/panicker): ```rust #![no_std] #![no_main] extern crate libc; #[no_mangle] extern "C" fn main() -> libc::c_int { panic!("I just panic every time"); } #[panic_handler] fn my_panic(panic_info: &core::panic::PanicInfo) -> ! { use arrayvec::ArrayString; use core::fmt::Write; let message = panic_info.message(); let location = panic_info.location().unwrap(); let mut debug_msg = ArrayString::<1024>::new(); let _ = write!(&mut debug_msg, "panicked with '{message}' at '{location}'"); if debug_msg.try_push_str("\0").is_ok() { unsafe { libc::puts(debug_msg.as_ptr() as *const _); } } unsafe { libc::exit(libc::EXIT_FAILURE) } } ``` ``` $ cargo +stage1 run --release panicked with 'I just panic every time' at 'src/main.rs:8:5' ``` - [x] FCP: https://github.com/rust-lang/rust/issues/66745#issuecomment-2198143725 r? libs-api
2024-06-24Replace `MaybeUninit::uninit_array()` with array repeat expression.Kevin Reid-2/+0
This is possible now that inline const blocks are stable; the idea was even mentioned as an alternative when `uninit_array()` was added: <https://github.com/rust-lang/rust/pull/65580#issuecomment-544200681> > if it’s stabilized soon enough maybe it’s not worth having a > standard library method that will be replaceable with > `let buffer = [MaybeUninit::<T>::uninit(); $N];` Const array repetition and inline const blocks are now stable (in the next release), so that circumstance has come to pass, and we no longer have reason to want `uninit_array()` other than convenience. Therefore, let’s evaluate the inconvenience by not using `uninit_array()` in the standard library, before potentially deleting it entirely.
2024-06-23wasm64 build with target-feature=+simd128,+atomicswooden-worm-0/+1
2024-06-21Remove `feature(effects)` from the standard libraryDeadbeef-1/+0
2024-06-20Stabilize `PanicInfo::message()` and `PanicMessage`StackOverflowExcept1on-1/+0
2024-06-19Stabilize `hint_assert_unchecked`Trevor Gross-1/+0
Make both `hint_assert_unchecked` and `const_hint_assert_unchecked` stable as `hint_assert_unchecked`.
2024-06-19Stabilise c_unwindGary Guo-1/+1
2024-06-07Stabilize `error_in_core`Slanterns-1/+0
2024-02-20Stabilize `LazyCell` and `LazyLock` (`lazy_cell`)Peter Jaszkowiak-1/+0
2024-05-23Replace fake "restricted-std" Cargo feature by custom cfgUrgau-2/+2
2024-05-20Remove Windows dependency on libcBen Kimock-0/+1
2024-05-01Step bootstrap cfgsMark Rousskov-2/+1
2024-04-28Auto merge of #124210 - the8472:consign-ebadf-to-the-fire, r=Mark-Simulacrumbors-0/+1
Abort a process when FD ownership is violated When an owned FD has already been closed before it's dropped that means something else touched an FD in ways it is not allowed to. At that point things can already be arbitrarily bad, e.g. clobbered mmaps. Recovery is not possible. All we can do is hasten the fire. Unlike the previous attempt in #124130 this shouldn't suffer from the possibility that FUSE filesystems can return arbitrary errors.
2024-04-26Auto merge of #123909 - dtolnay:utf8chunks, r=joboetbors-1/+0
Stabilize `Utf8Chunks` Pending FCP in https://github.com/rust-lang/rust/issues/99543. This PR includes the proposed modification in https://github.com/rust-lang/libs-team/issues/190 as agreed in https://github.com/rust-lang/rust/issues/99543#issuecomment-2050406568.
2024-04-24Stabilize Utf8ChunksDavid Tolnay-1/+0
2024-04-22export assert_unsafe_precondition macro for std-internal useThe 8472-0/+1
2024-04-22Stabilize generic `NonZero`.Markus Reiter-1/+0
2024-04-18Auto merge of #123144 - dpaoliello:arm64eclib, ↵bors-0/+1
r=GuillaumeGomez,ChrisDenton,wesleywiser Add support for Arm64EC to the Standard Library Adds the final pieces so that the standard library can be built for arm64ec-pc-windows-msvc (initially added in #119199) * Bumps `windows-sys` to 0.56.0, which adds support for Arm64EC. * Correctly set the `isEC` parameter for LLVM's `writeArchive` function. * Add `#![feature(asm_experimental_arch)]` to library crates where Arm64EC inline assembly is used, as it is currently unstable.
2024-04-17Stabilize `const_io_structs`Slanterns-1/+0
2024-04-15Add support for Arm64EC to the Standard LibraryDaniel Paoliello-0/+1
2024-04-14Replace libc::c_int with core::ffi::c_intChris Denton-0/+3
And remove the libc crate when it isn't needed
2024-04-13Rollup merge of #123868 - eduardosm:stabilize-slice_ptr_len, r=jhprattJacob Pratt-1/+0
Stabilize (const_)slice_ptr_len and (const_)slice_ptr_is_empty_nonnull Stabilized API: ```rust impl<T> *mut [T] { pub const fn len(self) -> usize; pub const fn is_empty(self) -> bool; } impl<T> *const [T] { pub const fn len(self) -> usize; pub const fn is_empty(self) -> bool; } impl<T> NonNull<[T]> { pub const fn is_empty(self) -> bool; } ``` FCP completed in tracking issue: https://github.com/rust-lang/rust/issues/71146
2024-04-12Stabilize (const_)slice_ptr_len and (const_)slice_ptr_is_empty_nonnullEduardo Sánchez Muñoz-1/+0
2024-04-12fix typo in library/std/src/lib.rskamaboko123-1/+1
2024-04-11Rollup merge of #123360 - adamgemmell:dev/adagem01/restricted-std, r=ehussLeón Orell Valerian Liehr-1/+10
Document restricted_std This PR aims to pin down exactly what restricted_std is meant to achieve and what it isn't. This commit fixes https://github.com/rust-lang/wg-cargo-std-aware/issues/87 by explaining why the error appears and what the choices the user has. The error describes how std cannot function without knowing about some form of OS/platform support. Any features of std that work without an OS should be moved to core/alloc (see https://github.com/rust-lang/rust/issues/27242 https://github.com/rust-lang/rust/issues/103765). Note that the message says "platform" and "environment" because, since https://github.com/rust-lang/rust/pull/120232, libstd can be built for some JSON targets. This is still unsupported (all JSON targets probably should be unstable https://github.com/rust-lang/wg-cargo-std-aware/issues/90), but a JSON target with the right configuration should hopefully have some partial libstd support. I propose closing https://github.com/rust-lang/wg-cargo-std-aware/issues/69 as "Won't fix" since any support of std without properly configured os, vendor or env fields is very fragile considering future upgrades of Rust or dependencies. In addition there's no likely path to it being fixed long term (making std buildable for all targets being the only solution). This is distinct from tier 3 platforms with limited std support implemented (and as such aren't restricted_std) because these platforms can conceptually work in the future and std support should mainly improve over time. The alternative to closing https://github.com/rust-lang/wg-cargo-std-aware/issues/69 is a new crate feature for std which escapes the restricted_std mechanism in build.rs. It could be used with the -Zbuild-std-features flag if we keep it permanently unstable, which I hope we can do anyway. A minor side-effect in this scenario is that std wouldn't be marked as unstable if documentation for it were generated with build-std. cc ```@ehuss```
2024-04-10Add basic f16 and f128 modulesTrevor Gross-0/+6
Create empty modules so `rustdoc` has someplace to link to for these types.
2024-04-08Add pattern types to parserOli Scherer-0/+3
2024-04-06remove miri-test-libstd hacks that are no longer neededRalf Jung-7/+1