about summary refs log tree commit diff
path: root/library/core
AgeCommit message (Collapse)AuthorLines
2024-12-03Rollup merge of #133762 - RalfJung:const-size-of-val, r=workingjubileeMatthias Krüger-6/+5
stabilize const_{size,align}_of_val FCP passed [here](https://github.com/rust-lang/rust/issues/46571#issuecomment-2460285288). Fixes https://github.com/rust-lang/rust/issues/46571.
2024-12-03Rollup merge of #133696 - RalfJung:const-hashmap, r=cuviperMatthias Krüger-3/+3
stabilize const_collections_with_hasher and build_hasher_default_const_new After a lot of preparatory work, finally we can stabilize creating `HashMap` in const context. :) FCP for const_collections_with_hasher passed in https://github.com/rust-lang/rust/issues/102575. Fixes https://github.com/rust-lang/rust/issues/102575. FCP for build_hasher_default_const_new passed in https://github.com/rust-lang/rust/issues/123197. Fixes https://github.com/rust-lang/rust/issues/123197. Cc `@Amanieu` Release notes: https://github.com/rust-lang/rust/issues/133347
2024-12-03Update the definition of `borrowing_sub`Tobias Decking-1/+1
This ensures that it matches the one in `carrying_add`.
2024-12-03Teach rust core about Xtensa VaListImpl and add a custom lowering of vaarg ↵Brian J. Tarricone-0/+20
for xtensa. LLVM does not include an implementation of the va_arg instruction for Xtensa. From what I understand, this is a conscious decision and instead language frontends are encouraged to implement it themselves. The rationale seems to be that loading values correctly requires language and ABI-specific knowledge that LLVM lacks. This is true of most architectures, and rustc already provides implementation for a number of them. This commit extends the support to include Xtensa. See https://lists.llvm.org/pipermail/llvm-dev/2017-August/116337.html for some discussion on the topic. Unfortunately there does not seem to be a reference document for the semantics of the va_list and va_arg on Xtensa. The most reliable source is the GCC implementation, which this commit tries to follow. Clang also provides its own compatible implementation. This was tested for all the types that rustc allows in variadics. Co-authored-by: Brian Tarricone <brian@tarricone.org> Co-authored-by: Jonathan Bastien-Filiatrault <joe@x2a.org> Co-authored-by: Paul Lietar <paul@lietar.net>
2024-12-02Add `core::arch::breakpoint` and testJosh Triplett-0/+39
Approved in [ACP 491](https://github.com/rust-lang/libs-team/issues/491). Remove the `unsafe` on `core::intrinsics::breakpoint()`, since it's a safe intrinsic to call and has no prerequisites. (Thanks to @zachs18 for figuring out the `bootstrap`/`not(bootstrap)` logic.)
2024-12-03Add doc alias 'then_with' for `then` method on `bool`Ross MacArthur-0/+1
2024-12-03Rollup merge of #133395 - calebzulawski:simd_relaxed_fma, r=workingjubileeMatthias Krüger-0/+14
Add simd_relaxed_fma intrinsic Adds compiler support for https://github.com/rust-lang/portable-simd/issues/387#issuecomment-2337169786 r? `@workingjubilee` cc `@RalfJung` is this kind of nondeterminism a problem for miri/opsem?
2024-12-02Rollup merge of #133763 - Urgau:f16-midpoint-const-feat, r=AmanieuGuillaume Gomez-1/+1
Fix `f16::midpoint` const feature gate cc https://github.com/rust-lang/rust/pull/131784#discussion_r1866074470
2024-12-02Rollup merge of #131713 - tgross35:stabilize-const_maybe_uninit_write, ↵Guillaume Gomez-2/+2
r=RalfJung,dtolnay Stabilize `const_maybe_uninit_write` Mark the following API const stable: ```rust impl<T> MaybeUninit<T> { pub const fn write(&mut self, val: T) -> &mut T; } ``` This depends on `const_mut_refs` and [`const_maybe_uninit_assume_init`](https://github.com/rust-lang/rust/issues/86722), both of which have recently been stabilized. Closes: <https://github.com/rust-lang/rust/issues/63567>
2024-12-02stabilize const_{size,align}_of_valRalf Jung-6/+5
2024-12-02Stabilize `const_maybe_uninit_write`Trevor Gross-2/+2
Mark the following API const stable: impl<T> MaybeUninit<T> { pub const fn write(&mut self, val: T) -> &mut T; } This depends on `const_mut_refs` and `const_maybe_uninit_assume_init`, both of which have recently been stabilized. Tracking issue: <https://github.com/rust-lang/rust/issues/63567>
2024-12-02Allow fn pointers comparisons lint in libraryUrgau-0/+1
2024-12-02Fix `f16::midpoint` const feature gateUrgau-1/+1
2024-12-02Rollup merge of #133743 - bjoernager:slice-as-array, r=joboetGuillaume Gomez-1/+1
Fix docs for `<[T]>::as_array`. Tracking issue: #133508 This PR fixes a small typographical error in the docs entry for `<[T]>::as_array`.
2024-12-02stabilize const_collections_with_hasher and build_hasher_default_const_newRalf Jung-3/+3
2024-12-02Auto merge of #133728 - jhpratt:rollup-k1i60pg, r=jhprattbors-36/+2
Rollup of 4 pull requests Successful merges: - #133589 (Remove `hir::ArrayLen`) - #133672 (Remove a bunch of unnecessary const stability noise) - #133678 (Stabilize `ptr::fn_addr_eq`) - #133727 (Update mailmap) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-02Fix docs for '<[T]>::as_array';Gabriel Bjørnager Jensen-1/+1
2024-12-01Rollup merge of #133678 - Urgau:stabilize-ptr_fn_addr_eq, r=jhprattJacob Pratt-3/+1
Stabilize `ptr::fn_addr_eq` This PR stabilize the `ptr::fn_addr_eq` function. FCP completed in https://github.com/rust-lang/rust/issues/129322#issuecomment-2508304516 Closes https://github.com/rust-lang/rust/issues/129322
2024-12-01Rollup merge of #133672 - RalfJung:const-stability-cleanup, r=jhprattJacob Pratt-33/+1
Remove a bunch of unnecessary const stability noise
2024-12-01Rollup merge of #131784 - Urgau:stabilize-midpoint, r=dtolnayJacob Pratt-37/+34
Stabilize unsigned and float variants of `num_midpoint` feature This PR proposes that we stabilize the unsigned variants of the [`num_midpoint`](https://github.com/rust-lang/rust/issues/110840#issue-1684506201) feature as well as the floats variants, since they are not subject to any unresolved questions, which is equivalent to doing `(a + b) / 2` (and `(a + b) >> 1`) in a sufficiently large number. The stabilized API surface would be: ```rust /// Calculates the middle point of `self` and `rhs`. /// /// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a sufficiently-large unsigned integral type. /// This implies that the result is always rounded towards negative infinity and that no overflow will ever occur. impl u{8,16,32,64,128,size} { pub const fn midpoint(self, rhs: Self) -> Self; } impl NonZeroU{8,16,32,64,size} { pub const fn midpoint(self, rhs: Self) -> Self; } impl f{32,64} { pub const fn midpoint(self, rhs: Self) -> Self; } ``` The signed variants `u{8,16,32,64,128,size}` would remain gated, until a decision is made about the rounding mode, in other words that the [unresolved questions](https://github.com/rust-lang/rust/issues/110840#issue-1684506201) are resolved. cc `@rust-lang/libs-api` cc `@scottmcm` r? libs-api
2024-12-01Rollup merge of #131416 - okaneco:const_copy, r=RalfJungJacob Pratt-6/+10
Mark `slice::copy_from_slice` unstably const Tracking issue #131415 I used `const_eval_select` for runtime and const panic functions because const formatting isn't available yet.
2024-12-01Mark `slice::copy_from_slice` unstably constokaneco-6/+10
2024-12-01Rollup merge of #133674 - scottmcm:chain-carrying-add, r=AmanieuMatthias Krüger-1/+1
Fix chaining `carrying_add`s Something about the MIR lowering for `||` ended up breaking this, but it's fixed by changing the code to use `|` instead. I also added an assembly test to ensure it *keeps* being [`adc`](https://www.felixcloutier.com/x86/adc). cc https://github.com/rust-lang/rust/issues/85532#issuecomment-2495119815, which noticed this.
2024-12-01Rollup merge of #133669 - RalfJung:const_swap_splitup, r=dtolnayMatthias Krüger-3/+23
Move some functions out of const_swap feature gate - `swap_unchecked` is still unstable as a regular fn, so that feature gate can also cover its constness. - `swap_nonoverlapping` isn't ready to be stabilized yet, so make it a different feature gate. Part of https://github.com/rust-lang/rust/issues/83163, https://github.com/rust-lang/rust/issues/88539, https://github.com/rust-lang/rust/issues/133668
2024-12-01Stabilize unsigned `num_midpoint` featureUrgau-37/+34
2024-12-01Rollup merge of #133686 - samueltardieu:push-xkxwxzxqokuu, r=compiler-errorsMatthias Krüger-0/+1
Add diagnostic item for `std::ops::ControlFlow` This will be used in Clippy to detect useless conversions done through `ControlFlow::map_break()` and `ControlFlow::map_continue()`.
2024-11-30Add diagnostic item for `std::ops::ControlFlow`Samuel Tardieu-0/+1
This will be used in Clippy to detect useless conversions done through `ControlFlow::map_break()` and `ControlFlow::map_continue()`.
2024-11-30Auto merge of #133659 - jieyouxu:rollup-576gh4p, r=jieyouxubors-595/+949
Rollup of 6 pull requests Successful merges: - #131551 (Support input/output in vector registers of PowerPC inline assembly) - #132515 (Fix and undeprecate home_dir()) - #132721 (CI: split x86_64-mingw job) - #133106 (changes old intrinsic declaration to new declaration) - #133496 (thread::available_parallelism for wasm32-wasip1-threads) - #133548 (Add `BTreeSet` entry APIs to match `HashSet`) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-30Stabilize `ptr::fn_addr_eq`Urgau-3/+1
2024-11-30get rid of a bunch of unnecessary rustc_const_unstableRalf Jung-13/+1
2024-11-30Fix chaining `carrying_add`sScott McMurray-1/+1
Something about the MIR lowering for `||` ended up breaking this, but it's fixed by changing the code to use `|` instead. I also added an assembly test to ensure it *keeps* being `adc`.
2024-11-30add test for bytewise ptr::swap of a pointerRalf Jung-0/+20
2024-11-30remove a whole bunch of unnecessary const feature gatesRalf Jung-20/+0
2024-11-30move swap_nonoverlapping constness to separate feature gateRalf Jung-2/+2
2024-11-30move slice::swap_unchecked constness to slice_swap_unchecked feature gateRalf Jung-1/+1
2024-11-30Rollup merge of #133106 - BLANKatGITHUB:intrinsic, r=RalfJung许杰友 Jieyou Xu (Joe)-595/+949
changes old intrinsic declaration to new declaration This pr is for issue #132735 It changes old `extern "intrinsic"` code block with new declaration. There are other blocks that use old declaration but as the changes needed in single block is quite large I do them in parts
2024-11-30Rollup merge of #133625 - RalfJung:custom-mir-debug-info, r=compiler-errors许杰友 Jieyou Xu (Joe)-0/+33
custom MIR: add doc comment for debuginfo This is a revival of https://github.com/rust-lang/rust/pull/117015
2024-11-29Auto merge of #133533 - BoxyUwU:bump-boostrap, r=jieyouxu,Mark-Simulacrumbors-378/+161
Bump boostrap compiler to new beta Currently failing due to something about the const stability checks and `panic!`. I'm not sure why though since I wasn't able to see any PRs merged in the past few days that would result in a `cfg(bootstrap)` that shouldn't be removed. cc `@RalfJung` #131349
2024-11-29refine mir debuginfo docsRalf Jung-5/+14
2024-11-29Doc comment custom MIR debuginfo.Camille GILLOT-0/+24
and add a test for the constant case
2024-11-29Rollup merge of #133530 - timvisee:master, r=jhprattMatthias Krüger-42/+42
Use consistent wording in docs, use is zero instead of is 0 In documentation, wording of _"`rhs` is zero"_ and _"`rhs` is 0"_ is intermixed. This is especially visible [here](https://doc.rust-lang.org/std/primitive.usize.html#method.div_ceil). This changes all occurrences to _"`rhs` is zero"_ for better readability.
2024-11-29Rollup merge of #133466 - aksh1618:patch-1, r=thomccMatthias Krüger-3/+3
Fix typos in pin.rs
2024-11-28Change `GetManyMutError` to match T-libs-api decisionChayim Refael Friedman-28/+32
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()`.
2024-11-28Also use zero when referencing to capacity or lengthtimvisee-18/+18
2024-11-28Use consistent wording in docs, use zero instead of 0timvisee-24/+24
2024-11-28Rollup merge of #133512 - bjoernager:slice-as-array, r=AmanieuGuillaume Gomez-16/+75
Add `as_array` and `as_mut_array` conversion methods to slices. Tracking issue: #133508 This PR unstably implements the `as_array` and `as_mut_array` converters to `[T]`, `*const [T]`, and `*mut [T]`.
2024-11-27update cfgsBoxy-307/+90
2024-11-27replace placeholder versionBoxy-77/+77
2024-11-26Rollup merge of #133402 - compiler-errors:drop-and-destruct, r=lcnrMichael Goulet-1/+2
Constify `Drop` and `Destruct` r? `@lcnr` or `@fee1-dead`
2024-11-26Add '<[T]>::as_array', '<[T]>::as_mut_array', '<*const [T]>::as_array', and ↵Gabriel Bjørnager Jensen-16/+75
'<*mut [T]>::as_mut_array' conversion methods;