about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2024-12-14Rollup merge of #134022 - shahn:doc_clarify_extend_for_tuple_version, r=tgross35Matthias Krüger-7/+56
Doc: Extend for tuples to be stabilized in 1.85.0 I assumed the RUSTC_CURRENT_VERSION would be replaced automatically, but it doesn't look like it on the nightly docs page. Sorry!
2024-12-14Rollup merge of #133986 - olishmollie:tracking-issue-127154-documentation, ↵Matthias Krüger-5/+135
r=tgross35 Add documentation for anonymous pipe module Tracking issue: https://github.com/rust-lang/rust/issues/127154 `@NobodyXu` I've been using this feature lately and thought I might contribute with some documentation. I borrowed liberally from [os_pipe](https://docs.rs/os_pipe/latest/os_pipe/) so thanks to `@oconnor663.`
2024-12-14Correct spelling of CURRENT_RUSTC_VERSIONSebastian Hahn-7/+56
I mixed it up with RUSTC_CURRENT_VERSION unfortunately. Also improve the formatting of the macro invocation slightly.
2024-12-14Replace i32 by char in `split_at` & `_unchecked`tkirishima-12/+12
2024-12-14Add clarity to the "greater" of `VecDeque::insert`tkirishima-1/+1
2024-12-14Replace i32 by char to add claritytkirishima-23/+26
In some `Vec` and `VecDeque` examples where elements are i32, examples can seem a bit confusing at first glance if a parameter of the method is an usize.
2024-12-14Auto merge of #134296 - matthiaskrgr:rollup-o0sxozj, r=matthiaskrgrbors-3/+89
Rollup of 6 pull requests Successful merges: - #132150 (Fix powerpc64 big-endian FreeBSD ABI) - #133942 (Clarify how to use `black_box()`) - #134081 (Try to evaluate constants in legacy mangling) - #134192 (Remove `Lexer`'s dependency on `Parser`.) - #134208 (coverage: Tidy up creation of covmap and covfun records) - #134211 (On Neutrino QNX, reduce the need to set archiver via environment variables) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-14Add documentation for anonymous pipe moduleAndrew Bond-5/+135
2024-12-14Rollup merge of #133942 - BD103:black-box-docs, r=saethlinMatthias Krüger-3/+89
Clarify how to use `black_box()` Closes #133923. r? libs ^ (I think that's the right group, this is my first time!) This PR adds further clarification on the [`black_box()`](https://doc.rust-lang.org/stable/std/hint/fn.black_box.html) documentation. Specifically, it teaches _how_ to use it, instead of just _when_ to use it. I tried my best to make it clear and accurate, but a lot of my information is sourced from https://github.com/rust-lang/rust-clippy/issues/12707 and [manually inspecting assembly](https://godbolt.org/). Please tell me if I got anything wrong!
2024-12-14Rollup merge of #134255 - bjoernager:master, r=NoratriebMatthias Krüger-2/+2
Update includes in `/library/core/src/error.rs`. This PR removes the `crate::fmt::Result` include in `/library/core/src/error.rs`. The main issue with this `use` statement is that it shadows the `Result` type from the prelude (i.e. `crate::result::Result`). This indirectly makes all docs references to `Result` in this module point to the wrong type (but only in `core::error` - not `std::error`, wherein this include isn't present to begin with). Fixes: #134169
2024-12-14Rollup merge of #134254 - hermit-os:hermit-c_char, r=workingjubileeMatthias Krüger-6/+6
Fix building `std` for Hermit after `c_char` change These changes were made necessary by https://github.com/rust-lang/rust/pull/132975.
2024-12-14Rollup merge of #134252 - hermit-os:hermit-is_absolute, r=tgross35Matthias Krüger-1/+3
Fix `Path::is_absolute` on Hermit Paths on Hermit work like paths on Unix. Closes https://github.com/rust-lang/rust/issues/132141.
2024-12-13de-stabilize bench attributeRalf Jung-1/+0
2024-12-13rustdoc-search: let From and Into be unboxedMichael Howell-0/+2
2024-12-13Rollup merge of #134229 - purplesyringa:provenance-docs, r=saethlinMatthias Krüger-4/+5
Fix typos in docs on provenance This is related to [strict provenance](https://github.com/rust-lang/rust/issues/95228). Added a couple cross-refs, also replaced > Create a pointer without provenance from just an address (see [`ptr::dangling`]). with > Create a pointer without provenance from just an address (see [`without_provenance`]). as this method actually takes an address.
2024-12-13Rollup merge of #134140 - compiler-errors:unsafe-binders-ast, r=oli-obkMatthias Krüger-0/+29
Add AST support for unsafe binders I'm splitting up #130514 into pieces. It's impossible for me to keep up with a huge PR like that. I'll land type system support for this next, probably w/o MIR lowering, which will come later. r? `@oli-obk` cc `@BoxyUwU` and `@lcnr` who also may want to look at this, though this PR doesn't do too much yet
2024-12-13Remove buffers in tests for {f,}xsave{c,}{64,}Martin Liska-84/+0
Fixes: #1672
2024-12-13Enable LoongArch CIWANG Rui-3/+2
2024-12-13Remove support for specializing ToString outside the standard librarybjorn3-109/+43
This is the only trait specializable outside of the standard library. Before stabilizing specialization we will probably want to remove support for this. It was originally made specializable to allow a more efficient ToString in libproc_macro back when this way the only way to get any data out of a TokenStream. We now support getting individual tokens, so proc macros no longer need to call it as often.
2024-12-13Auto merge of #134047 - saethlin:inline-fmt-rt, r=m-ou-sebors-17/+17
Switch inline(always) in core/src/fmt/rt.rs to plain inline I have a vague memory of these being instantiated a lot. Let's ask perf. Looks like this is an improvement!
2024-12-13Update includes in '/library/core/src/error.rs';Gabriel Bjørnager Jensen-2/+2
2024-12-13Fix building `std` for Hermit after `c_char` changeMartin Kröning-6/+6
2024-12-13Fix `Path::is_absolute` on HermitMartin Kröning-1/+3
2024-12-13Reword prelude for AsyncFn stabilizationMichael Goulet-2/+3
2024-12-13Stabilize async closuresMichael Goulet-13/+25
2024-12-12Fix typos in docs on provenanceAlisa Sireneva-4/+5
2024-12-12feat: clarify how to use `black_box()`BD103-3/+89
Co-authored-by: Ben Kimock <kimockb@gmail.com>
2024-12-12`assert_instr` for AMXSayantan Chakraborty-0/+27
2024-12-12Use `core::intrinsics::fmaf16` instead of LLVM intrinsicSayantan Chakraborty-3/+1
2024-12-12Cleanup: remove redundant target featuresSayantan Chakraborty-48/+71
Make target feature verification stricter
2024-12-12Add numeric instructions for Wasm not available in `core`daxpedda-0/+142
2024-12-12Add unwrap_unsafe_binder and wrap_unsafe_binder macro operatorsMichael Goulet-0/+29
2024-12-12Rollup merge of #134179 - zachs18:align_offset_mut_ptr_doc, r=workingjubileeMatthias Krüger-9/+0
Remove outdated consteval note from `<*mut T>::align_offset` docs.
2024-12-12Rollup merge of #134178 - ehuss:stabilize-2024-prelude, ↵Matthias Krüger-6/+15
r=amanieu,traviscross,tgross35 Stabilize the Rust 2024 prelude This stabilizes the `core::prelude::rust_2024` and `std::prelude::rust_2024` modules. I missed these in the #133349 stabilization.
2024-12-12Rollup merge of #134155 - sthibaul:unsafe_op_in_unsafe_fn, r=tgross35Matthias Krüger-0/+1
Forbid `unsafe_op_in_unsafe_fn` for Hurd Tracking issue https://github.com/rust-lang/rust/issues/127747
2024-12-12Rollup merge of #133859 - bjorn3:move_tests_to_alloctests, r=tgross35Matthias Krüger-27/+123
Move some alloc tests to the alloctests crate Unit tests directly inside of standard library crates require a very fragile way of building that is hard to reproduce outside of bootstrap.
2024-12-12Rollup merge of #122003 - mati865:gnullvm-build-libunwind, r=petrochenkovMatthias Krüger-6/+8
link libunwind dynamically and allow controlling it via `crt-static` on gnullvm targets Alternative to https://github.com/rust-lang/rust/pull/121794 ``` $ cargo b -r Finished `release` profile [optimized] target(s) in 0.38s $ ntldd target/release/hello.exe | rg unwind libunwind.dll => H:\msys64\clang64\bin\libunwind.dll (0x0000020c35df0000) $ RUSTFLAGS="-C target-feature=+crt-static" cargo b -r Finished `release` profile [optimized] target(s) in 0.23s $ ntldd target/release/hello.exe | rg unwind ```
2024-12-11Stabilize the Rust 2024 preludeEric Huss-6/+15
2024-12-11Auto merge of #134177 - matthiaskrgr:rollup-hgp8q60, r=matthiaskrgrbors-81/+114
Rollup of 6 pull requests Successful merges: - #132975 (De-duplicate and improve definition of core::ffi::c_char) - #133598 (Change `GetManyMutError` to match T-libs-api decision) - #134148 (add comments in check_expr_field) - #134163 (coverage: Rearrange the code for embedding per-function coverage metadata) - #134165 (wasm(32|64): update alignment string) - #134170 (Subtree update of `rust-analyzer`) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-11Rollup merge of #133598 - ChayimFriedman2:get-many-mut-detailed-err, r=scottmcmMatthias Krüger-28/+34
Change `GetManyMutError` to match T-libs-api decision That is, differentiate between out-of-bounds and overlapping indices, and remove the generic parameter `N`. I also exported `GetManyMutError` from `alloc` (and `std`), which was apparently forgotten. Changing the error to carry additional details means LLVM no longer generates separate short-circuiting branches for the checks, instead it generates one branch at the end. I therefore changed the code to use early returns to make LLVM generate jumps. Benchmark results between the approaches are somewhat mixed, but I chose this approach because it is significantly faster with ranges and also faster with `unwrap()`. Benchmark (`jumps` refer to short-circuiting, `acc` is not short-circuiting): ```rust use criterion::{black_box, criterion_group, criterion_main, Criterion}; use my_crate::{get_many_check_valid_acc, get_many_check_valid_jumps, GetManyMutError}; mod externs { #[unsafe(no_mangle)] fn foo() {} #[unsafe(no_mangle)] fn bar() {} #[unsafe(no_mangle)] fn baz() {} } unsafe extern "C" { safe fn foo(); safe fn bar(); safe fn baz(); } fn bench_method(c: &mut Criterion) { c.bench_function("jumps two usize", |b| { b.iter(|| get_many_check_valid_jumps(&[black_box(1), black_box(5)], black_box(10))) }); c.bench_function("jumps two usize unwrap", |b| { b.iter(|| get_many_check_valid_jumps(&[black_box(1), black_box(5)], black_box(10)).unwrap()) }); c.bench_function("jumps two usize ok", |b| { b.iter(|| get_many_check_valid_jumps(&[black_box(1), black_box(5)], black_box(10)).ok()) }); c.bench_function("jumps three usize", |b| { b.iter(|| { get_many_check_valid_jumps(&[black_box(1), black_box(5), black_box(7)], black_box(10)) }) }); c.bench_function("jumps three usize match", |b| { b.iter(|| { match get_many_check_valid_jumps( &[black_box(1), black_box(5), black_box(7)], black_box(10), ) { Err(GetManyMutError::IndexOutOfBounds) => foo(), Err(GetManyMutError::OverlappingIndices) => bar(), Ok(()) => baz(), } }) }); c.bench_function("jumps two Range", |b| { b.iter(|| { get_many_check_valid_jumps( &[black_box(1)..black_box(5), black_box(7)..black_box(8)], black_box(10), ) }) }); c.bench_function("jumps two RangeInclusive", |b| { b.iter(|| { get_many_check_valid_jumps( &[black_box(1)..=black_box(5), black_box(7)..=black_box(8)], black_box(10), ) }) }); c.bench_function("acc two usize", |b| { b.iter(|| get_many_check_valid_acc(&[black_box(1), black_box(5)], black_box(10))) }); c.bench_function("acc two usize unwrap", |b| { b.iter(|| get_many_check_valid_acc(&[black_box(1), black_box(5)], black_box(10)).unwrap()) }); c.bench_function("acc two usize ok", |b| { b.iter(|| get_many_check_valid_acc(&[black_box(1), black_box(5)], black_box(10)).ok()) }); c.bench_function("acc three usize", |b| { b.iter(|| { get_many_check_valid_acc(&[black_box(1), black_box(5), black_box(7)], black_box(10)) }) }); c.bench_function("acc three usize match", |b| { b.iter(|| { match get_many_check_valid_jumps( &[black_box(1), black_box(5), black_box(7)], black_box(10), ) { Err(GetManyMutError::IndexOutOfBounds) => foo(), Err(GetManyMutError::OverlappingIndices) => bar(), Ok(()) => baz(), } }) }); c.bench_function("acc two Range", |b| { b.iter(|| { get_many_check_valid_acc( &[black_box(1)..black_box(5), black_box(7)..black_box(8)], black_box(10), ) }) }); c.bench_function("acc two RangeInclusive", |b| { b.iter(|| { get_many_check_valid_acc( &[black_box(1)..=black_box(5), black_box(7)..=black_box(8)], black_box(10), ) }) }); } criterion_group!(benches, bench_method); criterion_main!(benches); ``` Benchmark results: ```none jumps two usize time: [586.44 ps 590.20 ps 594.50 ps] jumps two usize unwrap time: [390.44 ps 393.63 ps 397.44 ps] jumps two usize ok time: [585.52 ps 591.74 ps 599.38 ps] jumps three usize time: [976.51 ps 983.79 ps 991.51 ps] jumps three usize match time: [390.82 ps 393.80 ps 397.07 ps] jumps two Range time: [1.2583 ns 1.2640 ns 1.2695 ns] jumps two RangeInclusive time: [1.2673 ns 1.2770 ns 1.2877 ns] acc two usize time: [592.63 ps 596.44 ps 600.52 ps] acc two usize unwrap time: [582.65 ps 587.07 ps 591.90 ps] acc two usize ok time: [581.59 ps 587.82 ps 595.71 ps] acc three usize time: [894.69 ps 901.23 ps 908.24 ps] acc three usize match time: [392.68 ps 395.73 ps 399.17 ps] acc two Range time: [1.5531 ns 1.5617 ns 1.5711 ns] acc two RangeInclusive time: [1.5746 ns 1.5840 ns 1.5939 ns] ```
2024-12-11Rollup merge of #132975 - arichardson:ffi-c-char, r=tgross35Matthias Krüger-53/+80
De-duplicate and improve definition of core::ffi::c_char Instead of having a list of unsigned char targets for each OS, follow the logic Clang uses and instead set the value based on architecture with a special case for Darwin and Windows operating systems. This makes it easier to support new operating systems targeting Arm/AArch64 without having to modify this config statement for each new OS. The new list does not quite match Clang since I noticed a few bugs in the Clang implementation (https://github.com/llvm/llvm-project/issues/115957). Fixes https://github.com/rust-lang/rust/issues/129945 Closes https://github.com/rust-lang/rust/pull/131319
2024-12-11Remove consteval note from <*mut T>::align_offset docs.Zachary S-9/+0
2024-12-11Rollup merge of #134079 - tbu-:pr_doc_x8_to_from_xe_bytes, r=jhprattJacob Pratt-4/+29
Add a note saying that `{u8,i8}::from_{be,le,ne}_bytes` is meaningless
2024-12-11Add a note saying that `{u8,i8}::from_{be,le,ne}_bytes` is meaninglessTobias Bucher-4/+29
2024-12-11Forbid unsafe_op_in_unsafe_fn in hurd-specific os and sys filesSamuel Thibault-0/+1
Adding it did not cause any error. Most of this falls back on Unix already. See #127747
2024-12-10Rollup merge of #134116 - RalfJung:const_nonnull_new, r=jhprattLeón Orell Valerian Liehr-4/+1
stabilize const_nonnull_new FCP passed in https://github.com/rust-lang/rust/issues/93235 Closes #93235
2024-12-10Rollup merge of #134100 - eholk:noop-rustc-const-stable, r=dtolnayLeón Orell Valerian Liehr-1/+0
Remove rustc_const_stable attribute on const NOOP This was accidentally reintroduced while editing #133089. r? dtolnay
2024-12-10Add references to the specific ABI documentsAlex Richardson-7/+63
Expcept for L4RE and Xtensa these were obtained from #131319 I could not find an open link to the Xtensa documentation, but the signedness was confirmed by on of the Xtensa developers in https://github.com/llvm/llvm-project/pull/115967#issuecomment-2506292323 Co-authored-by: Taiki Endo <te316e89@gmail.com>
2024-12-10Remove l4re from the unsigned char operating system listAlex Richardson-2/+2
As noted in https://github.com/rust-lang/rust/pull/132975#issuecomment-2484645240, the default for userland apps is to follow the architecture defaults, the -funsigned-char flag only applies to kernel builds.
2024-12-10De-duplicate and improve definition of core::ffi::c_charAlex Richardson-53/+24
Instead of having a list of unsigned char targets for each OS, follow the logic Clang uses and instead set the value based on architecture with a special case for Darwin and Windows operating systems. This makes it easier to support new operating systems targeting Arm/AArch64 without having to modify this config statement for each new OS. The new list does not quite match Clang since I noticed a few bugs in the Clang implementation (https://github.com/llvm/llvm-project/issues/115957). Fixes: https://github.com/rust-lang/rust/issues/129945