about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2024-11-28Use consistent wording in docs, use zero instead of 0timvisee-24/+24
2024-11-28Auto merge of #133561 - GuillaumeGomez:rollup-g4upmv4, r=GuillaumeGomezbors-16/+88
Rollup of 12 pull requests Successful merges: - #129409 (Expand std::os::unix::fs::chown() doc with a warning) - #133320 (Add release notes for Rust 1.83.0) - #133368 (Delay a bug when encountering an impl with unconstrained generics in `codegen_select`) - #133428 (Actually use placeholder regions for trait method late bound regions in `collect_return_position_impl_trait_in_trait_tys`) - #133512 (Add `as_array` and `as_mut_array` conversion methods to slices.) - #133519 (Check `xform_ret_ty` for WF in the new solver to improve method winnowing) - #133520 (Structurally resolve before applying projection in borrowck) - #133534 (extend group-forbid-always-trumps-cli test) - #133537 ([rustdoc] Fix new clippy lints) - #133543 ([AIX] create shim for lgammaf_r) - #133547 (rustc_span: Replace a `HashMap<_, ()>` with `HashSet`) - #133550 (print generated doc paths) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-28Rollup merge of #133543 - mustartt:aix-lgammaf_r-shim, r=cuviperGuillaume Gomez-0/+8
[AIX] create shim for lgammaf_r On AIX, we don't have 32bit floating point for re-entrant `lgammaf_r` but we do have the 64bit floating point re-entrant `lgamma_r` so we can use the 64bit version instead and truncate back to a 32bit float. This solves the linker missing symbol for `.lgammaf_r` when testing and using these parts of the `std`.
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-28Rollup merge of #129409 - grinapo:patch-1, r=AmanieuGuillaume Gomez-0/+5
Expand std::os::unix::fs::chown() doc with a warning Include warning about losing setuid/gid when chowning, per POSIX. It is about the underlying system call but it is rather useful to mention it in the help in case someone accidentally forgets (don't look at me :)).
2024-11-27Rollup merge of #133498 - GuillaumeGomez:missing-examples, r=joboetMatthias Krüger-2/+28
Add missing code examples on `LocalKey` r? ``@Amanieu``
2024-11-27Stabilize `extended_varargs_abi_support`Soveu-1/+0
2024-11-27Fill in a `BTreeSet::entry` exampleJosh Stone-1/+31
2024-11-27Add a tracking issue for `btree_set_entry`Josh Stone-20/+20
2024-11-27Add `BTreeSet` entry APIs to match `HashSet`Josh Stone-2/+500
* `fn get_or_insert(&mut self, value: T) -> &T` * `fn get_or_insert_with<Q: ?Sized, F>(&mut self, value: &Q, f: F) -> &T` * `fn entry(&mut self, value: T) -> Entry<'_, T, A>` (+ `Entry` APIs)
2024-11-27fmtHenry Jiang-1/+1
2024-11-27update cfgsBoxy-350/+106
2024-11-27Implement code reviewSebastian Urban-2/+1
2024-11-27replace placeholder versionBoxy-93/+93
2024-11-27Auto merge of #133369 - Zalathar:profiler-builtins-no-core, r=jieyouxubors-8/+8
Allow injecting a profiler runtime into `#![no_core]` crates An alternative to #133300, allowing `-Cinstrument-coverage` to be used with `-Zbuild-std`. The incompatibility between `profiler_builtins` and `#![no_core]` crates appears to have been caused by profiler_builtins depending on core, and therefore conflicting with core (or minicore). But that's a false dependency, because the profiler doesn't contain any actual Rust code. So we can just mark the profiler itself as `#![no_core]`, and remove the incompatibility error. --- For context, the error was originally added by #79958.
2024-11-27Rollup merge of #133449 - joboet:io_const_error, r=tgross35Matthias Krüger-266/+250
std: expose `const_io_error!` as `const_error!` ACP: https://github.com/rust-lang/libs-team/issues/205 Tracking issue: https://github.com/rust-lang/rust/issues/133448 Probably best reviewed commit-by-commit, the first one does the API change, the second does the mass-rename.
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-27Recommend using `run-docker.sh` instead of `run.sh` in `CONTRIBUTING.md`Asuna-2/+2
2024-11-27Fix RISC-V Packed SIMD intrinsics compilationAsuna-19/+136
2024-11-27Disable loongarch and wasm in CI due to fallout from SIMD ABI checkingAmanieu d'Antras-4/+5
2024-11-27Fix types for ARM SIMD32 intrinsicsAmanieu d'Antras-43/+43
These were previously defined using vector types which is incorrect. Instead, `{u}int{8x4,16x2}_t` are aliases for `i32` and `u32`. This also fixes CI since these types don't need to be passed in NEON registers and this was triggering a newly added compiler warning.
2024-11-26Auto merge of #133505 - compiler-errors:rollup-xjp8hdi, r=compiler-errorsbors-52/+341
Rollup of 12 pull requests Successful merges: - #133042 (btree: add `{Entry,VacantEntry}::insert_entry`) - #133070 (Lexer tweaks) - #133136 (Support ranges in `<[T]>::get_many_mut()`) - #133140 (Inline ExprPrecedence::order into Expr::precedence) - #133155 (Yet more `rustc_mir_dataflow` cleanups) - #133282 (Shorten the `MaybeUninit` `Debug` implementation) - #133326 (Remove the `DefinitelyInitializedPlaces` analysis.) - #133362 (No need to re-sort existential preds in relate impl) - #133367 (Simplify array length mismatch error reporting (to not try to turn consts into target usizes)) - #133394 (Bail on more errors in dyn ty lowering) - #133410 (target check_consistency: ensure target feature string makes some basic sense) - #133435 (miri: disable test_downgrade_observe test on macOS) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-26chore: Improve doc commentsPiotr Osiewicz-2/+3
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;
2024-11-26std: update internal uses of `io::const_error!`joboet-246/+213
2024-11-26Rollup merge of #133435 - RalfJung:test_downgrade_observe, r=tgross35Michael Goulet-1/+4
miri: disable test_downgrade_observe test on macOS Due to https://github.com/rust-lang/rust/issues/121950, this test can fail on Miri. The test is also quite slow on Miri (taking more than 30s) due to the high iteration count (a total of 2000), so let's reduce that a little. Fixes https://github.com/rust-lang/rust/issues/133421
2024-11-26Rollup merge of #133282 - tgross35:maybe-uninit-debug, r=AmanieuMichael Goulet-1/+12
Shorten the `MaybeUninit` `Debug` implementation Currently the `Debug` implementation for `MaybeUninit` winds up being pretty verbose. This struct: ```rust #[derive(Debug)] pub struct Foo { pub a: u32, pub b: &'static str, pub c: MaybeUninit<u32>, pub d: MaybeUninit<String>, } ``` Prints as: Foo { a: 0, b: "hello", c: core::mem::maybe_uninit::MaybeUninit<u32>, d: core::mem::maybe_uninit::MaybeUninit<alloc::string::String>, } The goal is just to be a standin for content so the path prefix doesn't add any useful information. Change the implementation to trim `MaybeUninit`'s leading path, meaning the new result is now: Foo { a: 0, b: "hello", c: MaybeUninit<u32>, d: MaybeUninit<alloc::string::String>, }
2024-11-26Rollup merge of #133136 - ChayimFriedman2:get-many-mut, r=AmanieuMichael Goulet-19/+249
Support ranges in `<[T]>::get_many_mut()` As per T-libs-api decision in #104642. I implemented that with a separate trait and not within `SliceIndex`, because doing that via `SliceIndex` requires adding support for range types that are (almost) always overlapping e.g. `RangeFrom`, and also adding fake support code for `impl SliceIndex<str>`. An inconvenience that I ran into was that slice indexing takes the index by value, but I only have it by reference. I could change slice indexing to take by ref, but this is pretty much the hottest code ever so I'm afraid to touch it. Instead I added a requirement for `Clone` (which all index types implement anyway) and cloned. This is an internal requirement the user won't see and the clone should always be optimized away. I also implemented `Clone`, `PartialEq` and `Eq` for the error type, since I noticed it does not do that when writing the tests and other errors in std seem to implement them. I didn't implement `Copy` because maybe we will want to put something non-`Copy` there.
2024-11-26Rollup merge of #133042 - cuviper:btreemap-insert_entry, r=AmanieuMichael Goulet-31/+76
btree: add `{Entry,VacantEntry}::insert_entry` This matches the recently-stabilized methods on `HashMap` entries. I've reused tracking issue #65225 for now, but we may want to split it.
2024-11-26Rollup merge of #133464 - RalfJung:whitespace-panic, r=joboetGuillaume Gomez-7/+7
std::thread: avoid leading whitespace in some panic messages This: ``` panic!( "use of std::thread::current() is not possible after the thread's local data has been destroyed" ) ``` will print a newline followed by a bunch of spaces, since the entire string literal is interpreted literally. I think the intention was to print the message without the newline and the spaces, so let's add some `\` to make that happen. r? ``@joboet``
2024-11-26Rollup merge of #133419 - CromFr:add-path-strip_prefix-test-example, r=AmanieuGuillaume Gomez-0/+1
Added a doc test for std::path::strip_prefix I was about 90% sure `Path::new("/test/haha/foo.txt").strip_prefix("/te")` would return an Err, but I couldn't find an example to confirm this behaviour. This should be an easy merge :)
2024-11-26Add missing code examples on `LocalKey`Guillaume Gomez-2/+28
2024-11-26thread::available_parallelism for wasm32-wasip1-threadsSebastian Urban-3/+14
The target has limited POSIX support and provides the sysconf function which allows querying the number of available CPUs.
2024-11-26Refactor ReadDir into a state machinePiotr Osiewicz-70/+101
2024-11-25Run TLS destructors for wasm32-wasip1-threadsSebastian Urban-0/+74
The target has support for pthreads and allows registration of TLS destructors.
2024-11-25Fix typos in pin.rsAakarshit Uppal-3/+3
2024-11-25std::thread: avoid leading whitespace in some panic messagesRalf Jung-7/+7
2024-11-25Constify Drop and DestructMichael Goulet-1/+2
2024-11-25std: expose `const_io_error!` as `const_error!`joboet-20/+37
ACP: rust-lang/libs-team#205 Tracking issue: #133448
2024-11-25Auto merge of #133247 - GuillaumeGomez:reduce-integer-display-impl, ↵bors-48/+32
r=workingjubilee Reduce integer `Display` implementation size I was thinking about #128204 and how we could reduce the size of the code and just realized that we didn't need the `_fmt` method to be implemented on signed integers, which in turns allow to simplify greatly the macro call. r? `@workingjubilee`
2024-11-25Support ranges in `<[T]>::get_many_mut()`Chayim Refael Friedman-19/+249
I implemented that with a separate trait and not within `SliceIndex`, because doing that via `SliceIndex` requires adding support for range types that are (almost) always overlapping e.g. `RangeFrom`, and also adding fake support code for `impl SliceIndex<str>`. An inconvenience that I ran into was that slice indexing takes the index by value, but I only have it by reference. I could change slice indexing to take by ref, but this is pretty much the hottest code ever so I'm afraid to touch it. Instead I added a requirement for `Clone` (which all index types implement anyway) and cloned. This is an internal requirement the user won't see and the clone should always be optimized away. I also implemented `Clone`, `PartialEq` and `Eq` for the error type, since I noticed it does not do that when writing the tests and other errors in std seem to implement them. I didn't implement `Copy` because maybe we will want to put something non-`Copy` there.
2024-11-25miri: disable test_downgrade_observe test on macOSRalf Jung-1/+4
2024-11-25Rollup merge of #132982 - suaviloquence:2-doc-changed-alloc-methods, ↵Matthias Krüger-4/+4
r=Mark-Simulacrum alloc: fix `Allocator` method names in `alloc` free function docs It looks like these got renamed in https://github.com/rust-lang/rust/commit/9274b37d99f608e5fde569788ee79bd72fc3cf13 but the docs never updated. I couldn't find any history for `Allocator::realloc`. The `grow` API is not 1:1 (e.g., it returns a result), so this may not be the correct change - let me know and I can change the method or even remove this entirely.
2024-11-25Rollup merge of #132533 - SUPERCILEX:patch-4, r=Mark-SimulacrumMatthias Krüger-0/+20
Add BorrowedBuf::into_filled{,_mut} methods to allow returning buffer with original lifetime See https://github.com/rust-lang/libs-team/issues/473 and tracking issue https://github.com/rust-lang/rust/issues/117693.
2024-11-24fix `Allocator` method names in `alloc` free function docsm-4/+4
2024-11-25Rollup merge of #133298 - n0toose:remove-dir-all-but-not-paths, r=Noratrieb许杰友 Jieyou Xu (Joe)-1/+2
Mention that std::fs::remove_dir_all fails on files This is explicitly mentioned for std::fs::remove_file. It is more likely for a slightly lazy programmer to believe that removing a file would work and that they do not have to distinguish between directories (with contents) and files themself, because of the function's recursive nature and how it distinguishes between files and directories when removing them. Follow-up for #133183.
2024-11-25Rollup merge of #133260 - compiler-errors:deref, r=fee1-dead许杰友 Jieyou Xu (Joe)-0/+47
Constify the `Deref`/`DerefMut` traits, too One more constification. Rebased on that one commit that makes it so we don't need to provide stability on const impls. r? fee1-dead
2024-11-25Rollup merge of #132730 - joboet:after_main_sync, r=Noratrieb许杰友 Jieyou Xu (Joe)-26/+59
std: allow after-main use of synchronization primitives By creating an unnamed thread handle when the actual one has already been destroyed, synchronization primitives using thread parking can be used even outside the Rust runtime. This also fixes an inefficiency in the queue-based `RwLock`: if `thread::current` was not initialized yet, it will create a new handle on every parking attempt without initializing `thread::current`. The private `current_or_unnamed` function introduced here fixes this.
2024-11-24Added a doc test for std::path::strip_prefixCrom (Thibaut CHARLES)-0/+1
2024-11-24Rollup merge of #133389 - eduardosm:stabilize-const_float_methods, r=RalfJungMatthias Krüger-50/+70
Stabilize `const_float_methods` Tracking issue: https://github.com/rust-lang/rust/issues/130843 Relnotes: #133383 Stabilized const API: ```rust // in `core` impl f32/f64 { pub const fn recip(self) -> Self; pub const fn to_degrees(self) -> Self; pub const fn to_radians(self) -> Self; pub const fn max(self, other: Self) -> Self; pub const fn min(self, other: Self) -> Self; pub const fn clamp(self, min: Self, max: Self) -> Self; pub const fn abs(self) -> Self; pub const fn signum(self) -> Self; pub const fn copysign(self, sign: Self) -> Self; } ``` Closes https://github.com/rust-lang/rust/issues/130843 r? libs-api cc `@RalfJung` -- I think the way const-stability attributes work have change a bit since the last time a wrote a const-stabilization PR, please make sure I got them right.