about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2024-05-04fix: Add `#[avr_skip]` for `__addsf3` & `__adddf3`Patryk Wychowaniec-0/+2
It looks like I've forgotten about them [back in 2023](https://github.com/rust-lang/compiler-builtins/pull/527).
2024-05-04Rollup merge of #124699 - scottmcm:split_at_unchecked_should_use_unchecked, ↵Matthias Krüger-3/+8
r=Nilstrieb Use `unchecked_sub` in `split_at` LLVM currently isn't figuring it out on its own, even in the checked version where it hypothetically could. Before: <https://rust.godbolt.org/z/PEY38YrKs> ```llvm bb1: ; preds = %start %4 = getelementptr inbounds float, ptr %x.0, i64 %n %5 = sub i64 %x.1, %n ``` After: ```llvm bb1: ; preds = %start %4 = getelementptr inbounds float, ptr %x.0, i64 %n %5 = sub nuw i64 %x.1, %n ``` This is not using the wrapper because there's already a ubcheck covering it, so I don't want this to get a second one once #121571 lands. --- This is basically the same as #108763, since `split_at` is essentially doing two `get_unchecked`s.
2024-05-04Rollup merge of #122441 - a1phyr:improve_read_impls, r=ChrisDentonMatthias Krüger-10/+33
Improve several `Read` implementations - `read_to_end` and `read_to_string` for `Cursor` - Error on OOM in `read_to_string` of `&[u8]` and `VecDeque<u8>` - Avoid making the slices contiguous in `VecDeque::read_to_string` - ~`read_exact` and (unstable) `read_buf_exact` for `Take`~ - ~`read_buf` for `UnixStream` and `&UnixStream`~ (moved to #123084) - `read_to_end` for `ChildStdErr`
2024-05-04Release version 0.1.110Amanieu d'Antras-1/+1
2024-05-04Update reference to rustc-std-workspace-coreMartin Nordholts-2/+2
2024-05-04Rollup merge of #124701 - scottmcm:unchecked_sub_docs, r=NilstriebMatthias Krüger-0/+25
Docs: suggest `uN::checked_sub` instead of check-then-unchecked As of #124114 it's exactly the same in codegen, so might as well not use `unsafe`. Note that this is only for *unsigned*, since the overflow conditions for `iN::checked_sub` are more complicated.
2024-05-04Rollup merge of #124700 - scottmcm:unneeded_cast, r=NilstriebMatthias Krüger-1/+1
Remove an unnecessary cast Very minor thing, obviously, but I randomly saw this unnecessary cast showing up in the UbChecks, so might as well get rid of it.
2024-05-04Rollup merge of #124293 - oli-obk:miri_intrinsic_fallback_body, r=RalfJungMatthias Krüger-2/+10
Let miri and const eval execute intrinsics' fallback bodies fixes https://github.com/rust-lang/miri/issues/3397 r? ``@RalfJung``
2024-05-04Rollup merge of #124159 - joboet:move_pal_thread_parking, r=ChrisDentonMatthias Krüger-57/+25
Move thread parking to `sys::sync` Part of #117276. I'll leave the platform-specific API abstractions in `sys::pal`, as per the initial proposal. I'm not entirely sure whether we'll want to keep it that way, but that remains to be seen. r? ``@ChrisDenton`` (if you have time)
2024-05-04Rollup merge of #123356 - joboet:set_current_size, r=ChrisDentonMatthias Krüger-2/+7
Reduce code size of `thread::set_current` #123265 introduced a rather large binary size regression, because it added an `unwrap()` call on a `Result<(), Thread>`, which in turn pulled its rather heavy `Debug` implementation. This PR fixes this by readding the `rtassert!` that was removed.
2024-05-04Docs: suggest `uN::checked_sub` instead of check-then-uncheckedScott McMurray-0/+25
As of 124114 it's exactly the same in codegen, so might as well not use `unsafe`. Note that this is only for *unsigned*, since the overflow conditions for `iN::checked_sub` are more complicated.
2024-05-04Remove an unnecessary castScott McMurray-1/+1
Very minor thing, obviously, but I randomly saw this unnecessary cast showing up in the UbChecks, so might as well get rid of it.
2024-05-04Use `unchecked_sub` in `split_at`Scott McMurray-3/+8
2024-05-04mark const_(de)allocate intrinsics as suitable for MiriRalf Jung-2/+7
2024-05-03Rollup merge of #124681 - risc0:erik/fix-test, r=joboetMichael Goulet-1/+3
zkvm: fix run_tests `zkvm` is single-threaded, similar to `emscripten` and `wasm`. The `cfg` for `zkvm` seems to have been dropped. This PR adds the `cfg` again.
2024-05-03Rollup merge of #124678 - UserIsntAvailable:feat/stabilize-split-at-checked, ↵Michael Goulet-15/+6
r=jhpratt Stabilize `split_at_checked` Closes #119128 For the const version of `slice::split_at_mut_checked`, I'm reusing the `const_slice_split_at_mut` feature flag (#101804). I don't if it okay to reuse tracking issues or if it preferred to create new ones...
2024-05-03Rollup merge of #124480 - Enselic:on-broken-pipe, r=jieyouxuMichael Goulet-16/+16
Change `SIGPIPE` ui from `#[unix_sigpipe = "..."]` to `-Zon-broken-pipe=...` In the stabilization [attempt](https://github.com/rust-lang/rust/pull/120832) of `#[unix_sigpipe = "sig_dfl"]`, a concern was [raised ](https://github.com/rust-lang/rust/pull/120832#issuecomment-2007394609) related to using a language attribute for the feature: Long term, we want `fn lang_start()` to be definable by any crate, not just libstd. Having a special language attribute in that case becomes awkward. So as a first step towards the next stabilization attempt, this PR changes the `#[unix_sigpipe = "..."]` attribute to a compiler flag `-Zon-broken-pipe=...` to remove that concern, since now the language is not "contaminated" by this feature. Another point was [also raised](https://github.com/rust-lang/rust/pull/120832#issuecomment-1987023484), namely that the ui should not leak **how** it does things, but rather what the **end effect** is. The new flag uses the proposed naming. This is of course something that can be iterated on further before stabilization. Tracking issue: https://github.com/rust-lang/rust/issues/97889
2024-05-03zkvm: fix run_testsErik Kaneda-1/+3
zkvm is single-threaded, similar to emscripten and wasm.
2024-05-03feat: stabilize `split_at_checked`UserIsntAvailable-15/+6
2024-05-03Rollup merge of #124593 - GKFX:cstr-literals-in-api-docs, r=workingjubileeMatthias Krüger-22/+29
Describe and use CStr literals in CStr and CString docs Mention CStr literals in the description of both types, and use them in some of the code samples for CStr. This is intended to make C string literals more discoverable. Additionally, I don't think the orange "This example is not tested" warnings are very encouraging, so I have made the examples on `CStr` build.
2024-05-03Rollup merge of #124059 - RalfJung:default_alloc_error_hook, r=workingjubileeMatthias Krüger-0/+6
default_alloc_error_hook: explain difference to default __rdl_oom in alloc Though I'm not sure if that is really the reason that this code is duplicated. On no_std it may already be possible to call user-defined code on allocation failure.
2024-05-03Rollup merge of #123815 - trueb2:patch-1, r=workingjubileeMatthias Krüger-2/+2
Fix cannot usage in time.rs Fix a small grammar error in usage of cannot in time.rs errors
2024-05-03Rollup merge of #122492 - GrigorenkoPV:ptr_as_ref_unchecked, r=workingjubileeMatthias Krüger-0/+151
Implement ptr_as_ref_unchecked Implementation of #122034. Prefixed the feature name with `ptr_` for clarity. Linked const-unstability to #91822, so the post there should probably be updated to mentions the 3 new methods when/if this PR is merged.
2024-05-03default_alloc_error_hook: explain difference to default __rdl_oom in allocRalf Jung-0/+6
2024-05-03Use `CURRENT_RUSTC_VERSION`Артём Павлов [Artyom Pavlov]-2/+2
2024-05-03Stabilize `div_duration`Артём Павлов [Artyom Pavlov]-5/+2
2024-05-03Rollup merge of #124649 - Meziu:master, r=ChrisDentonMatthias Krüger-0/+1
Fix HorizonOS build broken by #124210 HorizonOS (for the Tier-3 target `armv6k-nintendo-3ds`) does not support `dirfd()`, as many other similar targets.
2024-05-03Cleanup `manged-names` macroAmjad Alsharafi-22/+25
Don't generate the whole function if we are not going to use `no_mangle`, there is no point
2024-05-03Remove unneeded `weak` for `optimized-c` functionAmjad Alsharafi-1/+0
`weak` is only used with `no_mangle`
2024-05-03Apply `weak` attributes to all intrinsicsAmjad Alsharafi-117/+14
Removed the `weak-intrinsics` feature, so that all functions will have the `weak` linkage attribute. Also this fixed the bug in https://github.com/rust-lang/rust/issues/124042. Before this commit, generated code will be ```rust pub extern "C" fn <name>(...) -> ... { // code... } pub mod <name> { #[linkage = "weak"] #[no_mangle] pub extern "C" fn <name>(...) -> ... { super::<name>(...) } } ``` The issue is that there is 2 `weak` linkage, the first one is not required. Along refactoring `weak` attributes, this was fixed.
2024-05-03Ensure miri only uses fallback bodies that have manually been vetted to ↵Oli Scherer-0/+3
preserve all UB that the native intrinsic would have
2024-05-03Horizon OS: dirfd unavailableAndrea Ciliberti-0/+1
2024-05-03Rollup merge of #124626 - RalfJung:const_eval_select, r=joboetMatthias Krüger-2/+1
const_eval_select: add tracking issue
2024-05-03Rollup merge of #124609 - RalfJung:float-precision, r=cuviperMatthias Krüger-116/+174
variable-precision float operations can differ depending on optimization levels Follow-up to https://github.com/rust-lang/rust/pull/121793 and https://github.com/rust-lang/rust/pull/118217 that accounts for optimizations changing the precision of these functions. Fixes https://github.com/rust-lang/rust/issues/109118 Fixes https://github.com/rust-lang/rust/issues/71355
2024-05-03Rollup merge of #124604 - Enselic:std-gimli-symbolize, r=workingjubileeMatthias Krüger-2/+0
library/std: Remove unused `gimli-symbolize` feature library/backtrace also declares a feature called `gimli-symbolize` which appear used, but the feature in std with the same name is unused, so remove it.
2024-05-03Rollup merge of #124441 - bravequickcleverfibreyarn:string.rs, r=AmanieuMatthias Krüger-1/+1
String.truncate comment microfix (greater or equal) String.truncate calls Vec.truncate, in turn, and that states "is greater or equal to". Beside common sense.
2024-05-03Rollup merge of #124412 - RalfJung:io-safety, r=AmanieuMatthias Krüger-11/+22
io safety: update Unix explanation to use `Arc` Fixes https://github.com/rust-lang/rust/issues/124384 Cc ```@jsgf```
2024-05-03Rollup merge of #123480 - Nadrieril:impl-all-derefpures, r=compiler-errorsMatthias Krüger-4/+19
deref patterns: impl `DerefPure` for more std types Context: [deref patterns](https://github.com/rust-lang/rust/issues/87121). The requirements of `DerefPure` aren't precise yet, but these types unambiguously satisfy them. Interestingly, a hypothetical `impl DerefMut for Cow` that does a `Clone` would *not* be eligible for `DerefPure` if we allow mixing deref patterns with normal patterns. If the following is exhaustive then the `DerefMut` would cause UB: ```rust match &mut Cow::Borrowed(&()) { Cow::Owned(_) => ..., // Doesn't match deref!(_x) if false => ..., // Causes the variant to switch to `Owned` Cow::Borrowed(_) => ..., // Doesn't match // We reach unreachable } ```
2024-05-02Stabilize exclusive_rangeRoss Smyth-1/+1
2024-05-02Update based on reviewGeorge Bateman-7/+7
2024-05-02Change `SIGPIPE` ui from `#[unix_sigpipe = "..."]` to `-Zon-broken-pipe=...`Martin Nordholts-16/+16
In the stabilization attempt of `#[unix_sigpipe = "sig_dfl"]`, a concern was raised related to using a language attribute for the feature: Long term, we want `fn lang_start()` to be definable by any crate, not just libstd. Having a special language attribute in that case becomes awkward. So as a first step towards towards the next stabilization attempt, this PR changes the `#[unix_sigpipe = "..."]` attribute to a compiler flag `-Zon-broken-pipe=...` to remove that concern, since now the language is not "contaminated" by this feature. Another point was also raised, namely that the ui should not leak **how** it does things, but rather what the **end effect** is. The new flag uses the proposed naming. This is of course something that can be iterated on further before stabilization.
2024-05-02variable-precision float operations behave non-deterministicallyRalf Jung-116/+174
2024-05-02const_eval_select: add tracking issueRalf Jung-2/+1
2024-05-02add constants in std::f128::constsTrevor Spiteri-1/+110
2024-05-02add constants in std::f16::constsTrevor Spiteri-1/+106
2024-05-02add f128 associated constantsTrevor Spiteri-1/+83
NaN and infinity are not included as they require arithmetic.
2024-05-02add f16 associated constantsTrevor Spiteri-1/+83
NaN and infinity are not included as they require arithmetic.
2024-05-02Auto merge of #124419 - WaffleLapkin:never-type-fallback-docs, r=workingjubileebors-0/+47
Document never type fallback in `!`'s docs Pulled the documentation I've written for #123939. I want a single place where never type fallback is explained, which can be referred in all the lints and migration materials.
2024-05-02Add builtins for `f16`/`f128` float conversionsbeetrees-115/+283
2024-05-02std: move thread parking to `sys::sync`joboet-57/+25