about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-04-10update miniz_oxide to 0.8.8oyvindln-2/+2
0.8.7 can trigger a panic when debug assertions are enabled when used via flate2 in some cases
2025-04-09Auto merge of #139595 - matthiaskrgr:rollup-kaa8aim, r=matthiaskrgrbors-6/+16
Rollup of 10 pull requests Successful merges: - #138470 (Test interaction between RFC 2229 migration and use closures) - #138628 (Add more ergonomic clone tests) - #139164 (std: improve documentation for get_mut() methods regarding forgotten guards) - #139488 (Add missing regression GUI test) - #139489 (compiletest: Add directive `dont-require-annotations`) - #139513 (Report higher-ranked trait error when higher-ranked projection goal fails in new solver) - #139521 (triagebot: roll compiler reviewers for rustc/unstable book) - #139532 (Update `u8`-to-and-from-`i8` suggestions.) - #139551 (report call site of inlined scopes for large assignment lints) - #139575 (Remove redundant words) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-09chore: release v0.1.153github-actions[bot]-1/+10
2025-04-09Rollup merge of #139575 - timesince:master, r=wesleywiserMatthias Krüger-1/+1
Remove redundant words Remove redundant words
2025-04-09Rollup merge of #139532 - bjoernager:master, r=tgross35Matthias Krüger-2/+2
Update `u8`-to-and-from-`i8` suggestions. `u8::cast_signed` and `i8::cast_unsigned` have been stabilised, but `i8::from_ne_bytes` et al. still suggest using `as i8` or `as u8`.
2025-04-09Rollup merge of #139164 - xizheyin:issue-139034, r=joboetMatthias Krüger-3/+13
std: improve documentation for get_mut() methods regarding forgotten guards Fixes #139034 This PR improves the documentation for `get_mut()` methods in `Mutex`, `RefCell`, and `RwLock` to clarify their behavior when lock guards are forgotten (e.g., via std::mem::forget). The current documentation for these methods states that a mutable borrow "statically guarantees no locks exist", which is not entirely accurate. While a mutable borrow prevents new locks from being created, it does not clear or detect previously abandoned locks through `forget()`. This can lead to counterintuitive behavior: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=e68cefec12dcd435daf2237c16824ed3 https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=81263ad652c752afd63c903113d3082c https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=311baa4edb3abf82a25c8d7bf21a4a52 r? libs
2025-04-09Auto merge of #124810 - lincot:speed-up-string-push-and-string-insert, ↵bors-74/+132
r=tgross35 speed up `String::push` and `String::insert` Addresses the concerns described in #116235. The performance gain comes mainly from avoiding temporary buffers. Complex pattern matching in `encode_utf8` (introduced in #67569) has been simplified to a comparison and an exhaustive `match` in the `encode_utf8_raw_unchecked` helper function. It takes a slice of `MaybeUninit<u8>` because otherwise we'd have to construct a normal slice to uninitialized data, which is not desirable, I guess. Several functions still have that [unneeded zeroing](https://rust.godbolt.org/z/5oKfMPo7j), but a single instruction is not that important, I guess. `@rustbot` label T-libs C-optimization A-str
2025-04-09Update the `libm` submoduleTrevor Gross-0/+0
Includes [1] and [2], which should resolve problems cg_gcc has using scalar math operations as a fallback for vector operations. [1]: https://github.com/rust-lang/libm/pull/459 [2]: https://github.com/rust-lang/libm/pull/534
2025-04-09Ensure `swap_nonoverlapping` is really always untypedScott McMurray-48/+124
2025-04-09Rollup merge of #139099 - scottmcm:from_fn_docs, r=AmanieuMatthias Krüger-6/+27
Promise `array::from_fn` is generated in order of increasing indices Fixes #139061 I agree this needs to be documented because of the `FnMut`, either with a guarantee or to explicitly disclaim one. I'm pretty sure this will be non-controversial (like the other "well sure you *could* do it in a different order, but why?" things were), but I couldn't find any previous libs-api decision on it so it's seemingly a new promise that will need FCP. Basically, yes, it would be plausible to fill in the reverse order, but there's no obvious way we could ever know that that might even be a good idea, so forward seems like an easy thing to promise. We could always add a `from_fn_rev` or something later if there's ever a strong enough need, but it seems unlikely. Let's just do the obvious thing so it matches what `[gen(0), gen(1), …, gen(N-1)]` does.
2025-04-09Rollup merge of #138993 - CAD97:cfg_match_semitransparent, r=dtolnayMatthias Krüger-3/+4
Make `cfg_match!` a semitransparent macro IIUC this is preferred when (potentially) stabilizing `macro` items, to avoid potentially utilizing def-site hygiene instead of mixed-site. Tracking issue: #115585
2025-04-09Rollup merge of #138869 - ChrisDenton:command-curdir, r=tgross35Matthias Krüger-4/+83
Try not to use verbatim paths in `Command::current_dir` If possible, we should try not to use verbatim paths in `Command::current_dir`. It might work but it might also break code in the subprocess that assume the current directory isn't verbatim (including Windows APIs). cc ``@ehuss`` Side note: we now have a lot of ad-hoc fixes like this spread about the place. It'd be good to make a proper `WindowsPath` type that handles all this in one place. But that's a bigger job for another PR.
2025-04-09intra-doc linkBoxy-1/+1
2025-04-09update cfgsBoxy-128/+20
2025-04-09replace version placeholderBoxy-141/+141
2025-04-09Remove redundant wordstimesince-1/+1
2025-04-09Add missing `black_box` in `String` benchmarkslincot-26/+22
2025-04-09Speed up `String::push` and `String::insert`lincot-48/+110
Improve performance of `String` methods by avoiding unnecessary memcpy for the character bytes, with added codegen check to ensure compliance.
2025-04-09Add assembly version of simple operations on aarch64Trevor Gross-28/+155
Replace `core::arch` versions of the following with handwritten assembly, which avoids recursion issues (cg_gcc using `rint` as a fallback) as well as problems with `aarch64be`. * `rint` * `rintf` Additionally, add assembly versions of the following: * `fma` * `fmaf` * `sqrt` * `sqrtf` If the `fp16` target feature is available, which implies `neon`, also include the following: * `rintf16` * `sqrtf16` `sqrt` is added to match the implementation for `x86`. `fma` is included since it is used by many other routines. There are a handful of other operations that have assembly implementations. They are omitted here because we should have basic float math routines available in `core` in the near future, which will allow us to defer to LLVM for assembly lowering rather than implementing these ourselves.
2025-04-09Auto merge of #139552 - matthiaskrgr:rollup-b194mk8, r=matthiaskrgrbors-3/+3
Rollup of 10 pull requests Successful merges: - #139494 (Restrict some queries by def-kind more) - #139496 (Revert r-a changes of rust-lang/rust#139455) - #139506 (add missing word in doc comment (part 2)) - #139515 (Improve presentation of closure signature mismatch from `Fn` trait goal) - #139520 (compiletest maintenance: sort deps and drop dep on `anyhow`) - #139523 (Rustc dev guide subtree update) - #139526 (Fix deprecation note for std::intrinsics) - #139528 (compiletest: Remove the `--logfile` flag) - #139541 (Instantiate higher-ranked transmute goal w/ placeholders before emitting sub-obligations) - #139547 (Update library tracking issue template to set S-tracking-unimplemented) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-08Resolve small errors identified by recent clippyTrevor Gross-1/+1
2025-04-08Replace calls to `core::arch` intrinsics with assemblyTrevor Gross-15/+20
Some backends may replace calls to `core::arch` with multiple calls to `sqrt` [1], which becomes recursive. Help mitigate this by replacing the call with assembly. Results in the same assembly as the current implementation when built with optimizations. [1]: https://github.com/rust-lang/compiler-builtins/issues/649
2025-04-08Remove a mention of `force-soft-float` in `build.rs`Trevor Gross-3/+1
`libm` no longer uses this directly in `cfg`, it is only for setting other configuration in the `libm` `build.rs`. Clean up this configuration in `compiler-builtins` since it is unused.
2025-04-09Avoid verbatim paths in Command::current_dirChris Denton-4/+83
If possible, we should try not to use verbatim paths in Command::current_dir. It might work but it might also break code (including some Windows APIs) that assume the current directory isn't verbatim.
2025-04-08clarify std::fs::set_permissions symlink behaviorbinarycat-6/+8
nest under platform-specific behavior, factor rationale into its own section, and tweak language.
2025-04-08Rollup merge of #139526 - smanilov:issue-139505, r=RalfJungMatthias Krüger-3/+3
Fix deprecation note for std::intrinsics Also checked the rest of the mentions of std::mem in the changed file and they look good to me. Fixes #139505
2025-04-08Fix unreachable expression warningCelina G. Val-7/+19
Invert the order that we pass the arguments to the `contract_check_ensures` function to avoid the warning when the tail of the function is unreachable. Note that the call itself is also unreachable, but we have already handled that case by ignoring unreachable call for contract calls.
2025-04-08std(docs): clarify how std::fs::set_permisions works with symlinksbinarycat-0/+13
fixes https://github.com/rust-lang/rust/issues/75942 fixes https://github.com/rust-lang/rust/issues/124201
2025-04-08Rollup merge of #139500 - jogru0:117437, r=tgross35Matthias Krüger-0/+8
document panic behavior of Vec::resize and Vec::resize_with This adds panic documentation to ´Vec::resize´ and ´Vec::resize_with´. Fixes #117437.
2025-04-08Update 'u8'-to-and-from-'i8' suggestions;Gabriel Bjørnager Jensen-2/+2
2025-04-08Fix deprecation note for std::intrinsicsStan Manilov-3/+3
Also checked the rest of the mentions of std::mem in the changed file and they look good to me.
2025-04-08libtest: Pass the test's panic payload as Option instead of ResultZalathar-15/+20
Passing a `Result<(), &dyn Any>` to `calc_result` requires awkward code at both call sites, for no real benefit. It's much easier to just pass the payload as `Option<&dyn Any>`. No functional change, except that the owned payload is dropped slightly later.
2025-04-08document panic behavior of Vec::resize and Vec::resize_withJonathan Gruner-0/+8
2025-04-07Add feature detection for new amx variants and movrssayantn-10/+53
2025-04-07Update SDE to 9.53.0sayantn-14/+24
2025-04-07Enable contracts for const functionsCelina G. Val-14/+47
Use `const_eval_select!()` macro to enable contract checking only at runtime. The existing contract logic relies on closures, which are not supported in constant functions. This commit also removes one level of indirection for ensures clauses, however, it currently has a spurious warning message when the bottom of the function is unreachable.
2025-04-07update intrinsics/mod.rs comment about const intrinsicsRalf Jung-8/+4
2025-04-07f*::NAN: guarantee that this is a quiet NaNRalf Jung-32/+40
2025-04-07Rollup merge of #139455 - Skgland:remove_rust-intrinsic_ABI, r=oli-obkStuart Cook-0/+1
Remove support for `extern "rust-intrinsic"` blocks Part of rust-lang/rust#132735 Looked manageable and there didn't appear to have been progress in the last two weeks, so decided to give it a try.
2025-04-06Auto merge of #138951 - jwnrt:alloc-raw-vec-strict-prov, r=Noratriebbors-6/+23
Replace last `usize` -> `ptr` transmute in `alloc` with strict provenance API This replaces the `usize -> ptr` transmute in `RawVecInner::new_in` with a strict provenance API (`NonNull::without_provenance`). The API is changed to take an `Alignment` which encodes the non-null constraint needed for `Unique` and allows us to do the construction safely. Two internal-only APIs were added to let us avoid UB-checking in this hot code: `Layout::alignment` to get the `Alignment` type directly rather than as a `usize`, and `Unique::from_non_null` to create `Unique` in const context without a transmute.
2025-04-06Auto merge of #136077 - rust-lang:cargo_update, r=clubby789bors-2/+2
Weekly `cargo update` Automation to keep dependencies in `Cargo.lock` current. The following is the output from `cargo update`: ```txt compiler & tools dependencies: Locking 11 packages to latest compatible versions Updating blake3 v1.8.0 -> v1.8.1 Updating ctrlc v3.4.5 -> v3.4.6 Updating env_logger v0.11.7 -> v0.11.8 Updating errno v0.3.10 -> v0.3.11 Updating flate2 v1.1.0 -> v1.1.1 Updating indexmap v2.8.0 -> v2.9.0 Updating miniz_oxide v0.8.5 -> v0.8.7 Updating openssl-sys v0.9.106 -> v0.9.107 Updating redox_syscall v0.5.10 -> v0.5.11 Updating smallvec v1.14.0 -> v1.15.0 Updating tokio v1.44.1 -> v1.44.2 note: pass `--verbose` to see 40 unchanged dependencies behind latest library dependencies: Locking 1 package to latest compatible version Updating miniz_oxide v0.8.5 -> v0.8.7 note: pass `--verbose` to see 4 unchanged dependencies behind latest rustbook dependencies: Locking 30 packages to latest compatible versions Updating cc v1.2.17 -> v1.2.18 Updating clap v4.5.32 -> v4.5.35 Updating clap_builder v4.5.32 -> v4.5.35 Updating darling v0.20.10 -> v0.20.11 Updating darling_core v0.20.10 -> v0.20.11 Updating darling_macro v0.20.10 -> v0.20.11 Updating env_logger v0.11.7 -> v0.11.8 Updating errno v0.3.10 -> v0.3.11 Updating flate2 v1.1.0 -> v1.1.1 Updating iana-time-zone v0.1.61 -> v0.1.63 Updating icu_locid_transform_data v1.5.0 -> v1.5.1 Updating icu_normalizer_data v1.5.0 -> v1.5.1 Updating icu_properties_data v1.5.0 -> v1.5.1 Updating indexmap v2.8.0 -> v2.9.0 Updating log v0.4.26 -> v0.4.27 Updating miniz_oxide v0.8.5 -> v0.8.7 Updating once_cell v1.21.1 -> v1.21.3 Updating pest v2.7.15 -> v2.8.0 Updating pest_derive v2.7.15 -> v2.8.0 Updating pest_generator v2.7.15 -> v2.8.0 Updating pest_meta v2.7.15 -> v2.8.0 Updating redox_syscall v0.5.10 -> v0.5.11 Updating rustix v1.0.3 -> v1.0.5 Updating smallvec v1.14.0 -> v1.15.0 Updating string_cache v0.8.8 -> v0.8.9 Updating windows-core v0.52.0 -> v0.61.0 Adding windows-implement v0.60.0 Adding windows-interface v0.59.1 Adding windows-result v0.3.2 Adding windows-strings v0.4.0 ```
2025-04-06update docsBennet Bleßmann-0/+1
- src\doc\nomicon\src\ffi.md should also have its ABI list updated
2025-04-06Rollup merge of #139367 - GuillaumeGomez:proc-macro-values, r=UrgauGuillaume Gomez-0/+126
Add `*_value` methods to proc_macro lib This is the (re-)implementation of https://github.com/rust-lang/libs-team/issues/459. It allows to get the actual value (unescaped) of the different string literals. It was originally done in https://github.com/rust-lang/rust/pull/136355 but it broke the artifacts build so we decided to move the crate to crates.io to go around this limitation. Part of https://github.com/rust-lang/rust/issues/136652. Considering this is a copy-paste of the originally approved PR, no need to go through the whole process again. \o/ r? `@Urgau`
2025-04-06Rollup merge of #139072 - nickkuk:align_to_uninit_mut, r=Mark-SimulacrumGuillaume Gomez-2/+51
Add `slice::align_to_uninit_mut` Add new `slice::align_to_uninit_mut` method. Tracking issue: https://github.com/rust-lang/rust/issues/139062 ACP: https://github.com/rust-lang/libs-team/issues/564
2025-04-06Rollup merge of #138876 - thaliaarchi:trusty-stdio, r=NoratriebGuillaume Gomez-38/+49
Trusty: Implement `write_vectored` for stdio Currently, `write` for stdout and stderr on Trusty is implemented with the semantics of `write_all`. Instead, call the underlying syscall only once in `write` and use the default implementation of `write_all` like other platforms. Also, implement `write_vectored` by adding support for `IoSlice`. Refactor stdin to reuse the unsupported type like https://github.com/rust-lang/rust/pull/136769. It requires #138875 to fix the build for Trusty, though they do not conflict and can merge in either order. cc `@randomPoison`
2025-04-06Rollup merge of #138562 - kornelski:nth-panic, r=NoratriebGuillaume Gomez-25/+25
Optimize slice {Chunks,Windows}::nth I've noticed that the `nth` functions on slice iters had non-optimized-out bounds checks. The new implementation even generates branchless code.
2025-04-06RISC-V: check cfg (batch 1)Tsukasa OI-5/+0
rust-lang/rust#138823 added five new extensions as compiler target features. This commit reflects that fact and now checks static target features on `std::arch::is_riscv_feature_detected!` as well. * "Zicsr" * "Zicntr" * "Zihpm" * "Zifencei" * "Zihintpause"
2025-04-06doc changesizarma-6/+6
2025-04-06Rollup merge of #139123 - thaliaarchi:core-alloc-test-paths, r=bjorn3Stuart Cook-3/+3
tidy: Fix paths to `coretests` and `alloctests` Following `#135937` and `#136642`, tests for core and alloc are in coretests and alloctests. Fix tidy to lint for the new paths. Also, update comments referring to the old locations. Some context for changes which don't match that pattern: - `library/std/src/thread/local/dynamic_tests.rs` and `library/std/src/sync/mpsc/sync_tests.rs` were moved under `library/std/tests/` in 332fb7e6f1d (Move std::thread_local unit tests to integration tests, 2025-01-17) and b8ae372e483 (Move std::sync unit tests to integration tests, 2025-01-17), respectively, so are no longer special cases. - There never was a `library/core/tests/fmt.rs` file. That comment previously referred to `src/test/ui/ifmt.rs`, which was folded into `library/alloc/tests/fmt.rs` in 949c96660c3 (move format! interface tests, 2020-09-08). Now, the only matches for `(alloc|core)/tests` are in `compiler/rustc_codegen_{cranelift,gcc}/patches`. I don't know why CI hasn't broken because those patches can't apply. Or maybe they somehow still can apply? r? `@bjorn3`
2025-04-05Polymorphize `array::IntoIter`'s iterator implScott McMurray-141/+420