about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2024-04-27Auto merge of #124432 - zetanumbers:non_copy_into_raw_with_alloc, r=Nilstriebbors-7/+4
Relax `A: Clone` bound for `rc::Weak::into_raw_and_alloc` Makes this method to behave the same way as [`Box::into_raw_with_allocator`](https://doc.rust-lang.org/1.77.2/alloc/boxed/struct.Box.html#method.into_raw_with_allocator) and [`Vec::into_raw_parts_with_alloc`](https://doc.rust-lang.org/1.77.2/alloc/vec/struct.Vec.html#method.into_raw_parts_with_alloc). I have also noticed the inconsistent presence and naming, should probably be addressed in the future.
2024-04-27Relax `A: Clone` bound for `rc::Weak::into_raw_and_alloc`Daria Sukhonina-7/+4
2024-04-27Rollup merge of #124387 - workingjubilee:use-raw-pointers-in-thread-locals, ↵Matthias Krüger-9/+12
r=joboet thread_local: be excruciatingly explicit in dtor code Use raw pointers to accomplish internal mutability, and clearly split references where applicable. This reduces the likelihood that any of these parts are misunderstood, either by humans or the compiler's optimizations. Fixes #124317 r? ``@joboet``
2024-04-26thread_local: refine LazyKeyInner::take safety docJubilee-1/+1
Co-authored-by: joboet <jonasboettiger@icloud.com>
2024-04-26Rollup merge of #124410 - RalfJung:path-buf-transmute, r=NilstriebJacob Pratt-7/+25
PathBuf: replace transmuting by accessor functions The existing `repr(transparent)` was anyway insufficient as `OsString` was not `repr(transparent)`. And furthermore, on Windows it was blatantly wrong as `OsString` wraps `Wtf8Buf` which is a `repr(Rust)` type with 2 fields: https://github.com/rust-lang/rust/blob/51a7396ad3d78d9326ee1537b9ff29ab3919556f/library/std/src/sys_common/wtf8.rs#L131-L146 So let's just be honest about what happens and add accessor methods that make this abstraction-breaking act of PathBuf visible on the APIs that it pierces through. Fixes https://github.com/rust-lang/rust/issues/124409
2024-04-26Auto merge of #123909 - dtolnay:utf8chunks, r=joboetbors-40/+57
Stabilize `Utf8Chunks` Pending FCP in https://github.com/rust-lang/rust/issues/99543. This PR includes the proposed modification in https://github.com/rust-lang/libs-team/issues/190 as agreed in https://github.com/rust-lang/rust/issues/99543#issuecomment-2050406568.
2024-04-26PathBuf: replace transmuting by accessor functionsRalf Jung-7/+25
2024-04-26Auto merge of #124393 - scottmcm:do-the-macros-still-matter, r=joboetbors-21/+20
Convert some iter macros to normal functions With all the MIR optimization changes that have happened since these were written, let's see if they still actually matter. \*perf comes back\* Well, it looks like it's not longer relevant for instruction, cycle, nor wall-time perf. Looks like a bunch of things are maybe 10kb bigger in debug, but some are also 50k *smaller* in debug. So I think they should switch to being normal functions as the "greatly improves performance" justification for them being macros seems to no longer be true -- probably thanks to us always building `core` with `-Z inline-mir` so the difference is negligible.
2024-04-25Convert some iter macros to normal functionsScott McMurray-21/+20
With all the MIR optimization changes that have happened since these were written, let's see if they still actually matter.
2024-04-25Rollup merge of #124076 - NobodyXu:patch-1, r=dtolnayMichael Goulet-3/+1
Stablise io_error_downcast Tracking issue #99262 Closes #99262 FCP completed in https://github.com/rust-lang/rust/issues/99262#issuecomment-2077374397
2024-04-25thread_local: split refs to fields of KeyJubilee Young-3/+4
2024-04-25thread_local: use less &mut T in LazyKeyInner::takeJubilee Young-6/+8
Instead, use raw pointers to accomplish internal mutability throughout.
2024-04-25remove trivial boundslcnr-13/+7
2024-04-24Stabilize Utf8ChunksDavid Tolnay-40/+57
2024-04-25Rollup merge of #124351 - Treeniks:master, r=workingjubileeMatthias Krüger-1/+1
fix typo in binary_heap docs There was an extra "the" that should not be there.
2024-04-25Rollup merge of #124335 - ChrisDenton:stabilize-absolute, r=dtolnayMatthias Krüger-3/+1
Stabilize `std::path::absolute` FCP complete in https://github.com/rust-lang/rust/issues/92750#issuecomment-2075046985
2024-04-25Rollup merge of #124322 - whosehang:master, r=NilstriebMatthias Krüger-1/+1
chore: fix some typos in comments
2024-04-24fix typo in binary_heap docsThomas Lindae-1/+1
2024-04-24Auto merge of #124330 - fmease:rollup-a98y7jf, r=fmeasebors-9/+37
Rollup of 6 pull requests Successful merges: - #123316 (Test `#[unix_sigpipe = "inherit"]` with both `SIG_DFL` and `SIG_IGN`) - #123794 (More DefineOpaqueTypes::Yes) - #123881 (Bump Fuchsia versions) - #124281 (fix weak memory bug in TLS on Windows) - #124282 (windows fill_utf16_buf: explain the expected return value) - #124308 (Add diagnostic item for `std::iter::Enumerate`) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-24Stabilize `std::path::absolute`Chris Denton-3/+1
2024-04-24Add `cfg_attr(bootstrap)` to doc testsGary Guo-0/+3
2024-04-24Stabilise `inline_const`Gary Guo-7/+6
2024-04-24Rollup merge of #124308 - CBSpeir:diagnostic-item-enumerate, r=compiler-errorsLeón Orell Valerian Liehr-0/+1
Add diagnostic item for `std::iter::Enumerate` This adds a diagnostic item for `std::iter::Enumerate`. The change will be used by the clippy `unused_enumerate_index` lint to move away from type paths to using diagnostic items. see: https://github.com/rust-lang/rust-clippy/issues/5393
2024-04-24Rollup merge of #124282 - RalfJung:fill_utf16_buf, r=ChrisDentonLeón Orell Valerian Liehr-5/+14
windows fill_utf16_buf: explain the expected return value The comment just says "return what the syscall returns", but that doesn't work for all syscalls as the Windows API is not consistent in how buffer size is negotiated. For instance, GetUserProfileDirectoryW works a bit differently, and so home_dir_crt has to translate this to the usual protocol itself. So it's worth describing that protocol. r? ``@ChrisDenton``
2024-04-24Rollup merge of #124281 - RalfJung:win-tls, r=joboetLeón Orell Valerian Liehr-4/+22
fix weak memory bug in TLS on Windows We need to store the `key` *after* we register the dtor. Now I hope there isn't also some other reason why we have to actually register the dtor last... `@joboet` is there a reason you picked this particular order in https://github.com/rust-lang/rust/pull/102655? Fixes https://github.com/rust-lang/rust/issues/123583
2024-04-24Error on using `yield` without also using `#[coroutine]` on the closureOli Scherer-3/+4
And suggest adding the `#[coroutine]` to the closure
2024-04-24chore: fix some typos in commentswhosehang-1/+1
Signed-off-by: whosehang <whosehang@outlook.com>
2024-04-23Add diagnostic item for std::iter::EnumerateChristopher B. Speir-0/+1
2024-04-23Auto merge of #124302 - matthiaskrgr:rollup-2aya8n8, r=matthiaskrgrbors-7/+79
Rollup of 3 pull requests Successful merges: - #124003 (Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics)) - #124169 (Don't fatal when calling `expect_one_of` when recovering arg in `parse_seq`) - #124286 (Subtree sync for rustc_codegen_cranelift) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-23Rollup merge of #124003 - WaffleLapkin:dellvmization, r=scottmcm,RalfJung,antoyoMatthias Krüger-7/+79
Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics) This implements https://github.com/rust-lang/compiler-team/issues/693 minus what was implemented in #123226. Note: I decided to _not_ change `shl`/... builder methods, as it just doesn't seem worth it. r? ``@scottmcm``
2024-04-23Rollup merge of #123048 - RalfJung:layout, r=dtolnayLeón Orell Valerian Liehr-1/+3
alloc::Layout: explicitly document size invariant on the type level https://github.com/rust-lang/rust/pull/95295 added this to the constructor, but it seems worth documenting the type invariant at the type level.
2024-04-23Rollup merge of #123050 - RalfJung:panic_str, r=m-ou-seMatthias Krüger-14/+21
panic_str only exists for the migration to 2021 panic macros The only caller is `expect_failed`, which is already a cold inline(never) function, so inlining into that function should be fine. (And indeed `panic_str` was `#[inline]` anyway.) The existence of panic_str risks someone calling it when they should call `panic` instead, and I can't see a reason why this footgun should exist. I also extended the comment in `panic` to explain why it needs a `'static` string -- I know I've wondered about this in the past and it took me quite a while to understand.
2024-04-23fix weak memory bug in TLS on WindowsRalf Jung-4/+22
2024-04-23windows fill_utf16_buf: explain the expected return valueRalf Jung-5/+14
2024-04-23Rollup merge of #124266 - RalfJung:no-answer, r=joboetMatthias Krüger-8/+1
remove an unused type from the reentrant lock tests At least it seems unused. This was added back in 45aa6c8d1bc2f7863c92da6643de4642bb2d83bf together with a test related to poisoning; when the test got removed, it seems like it was forgotten to also remove this type.
2024-04-23Auto merge of #121801 - zetanumbers:async_drop_glue, r=oli-obkbors-0/+288
Add simple async drop glue generation This is a prototype of the async drop glue generation for some simple types. Async drop glue is intended to behave very similar to the regular drop glue except for being asynchronous. Currently it does not execute synchronous drops but only calls user implementations of `AsyncDrop::async_drop` associative function and awaits the returned future. It is not complete as it only recurses into arrays, slices, tuples, and structs and does not have same sensible restrictions as the old `Drop` trait implementation like having the same bounds as the type definition, while code assumes their existence (requires a future work). This current design uses a workaround as it does not create any custom async destructor state machine types for ADTs, but instead uses types defined in the std library called future combinators (deferred_async_drop, chain, ready_unit). Also I recommend reading my [explainer](https://zetanumbers.github.io/book/async-drop-design.html). This is a part of the [MCP: Low level components for async drop](https://github.com/rust-lang/compiler-team/issues/727) work. Feature completeness: - [x] `AsyncDrop` trait - [ ] `async_drop_in_place_raw`/async drop glue generation support for - [x] Trivially destructible types (integers, bools, floats, string slices, pointers, references, etc.) - [x] Arrays and slices (array pointer is unsized into slice pointer) - [x] ADTs (enums, structs, unions) - [x] tuple-like types (tuples, closures) - [ ] Dynamic types (`dyn Trait`, see explainer's [proposed design](https://github.com/zetanumbers/posts/blob/main/async-drop-design.md#async-drop-glue-for-dyn-trait)) - [ ] coroutines (https://github.com/rust-lang/rust/pull/123948) - [x] Async drop glue includes sync drop glue code - [x] Cleanup branch generation for `async_drop_in_place_raw` - [ ] Union rejects non-trivially async destructible fields - [ ] `AsyncDrop` implementation requires same bounds as type definition - [ ] Skip trivially destructible fields (optimization) - [ ] New [`TyKind::AdtAsyncDestructor`](https://github.com/zetanumbers/posts/blob/main/async-drop-design.md#adt-async-destructor-types) and get rid of combinators - [ ] [Synchronously undroppable types](https://github.com/zetanumbers/posts/blob/main/async-drop-design.md#exclusively-async-drop) - [ ] Automatic async drop at the end of the scope in async context
2024-04-22Rollup merge of #124230 - reitermarkus:generic-nonzero-stable, r=dtolnayGuillaume Gomez-21/+23
Stabilize generic `NonZero`. Tracking issue: https://github.com/rust-lang/rust/issues/120257 r? `@dtolnay`
2024-04-22Rollup merge of #115913 - FedericoStra:checked_ilog, r=the8472Guillaume Gomez-27/+89
checked_ilog: improve performance Addresses #115874. (This PR replicates the original #115875, which I accidentally closed by deleting my forked repository...)
2024-04-22remove an unused type from the reentrant lock testsRalf Jung-8/+1
2024-04-22Stabilize generic `NonZero`.Markus Reiter-21/+23
2024-04-22Rollup merge of #124246 - gurry:add-comma-in-abs-doc, r=jhprattMatthias Krüger-1/+1
Add comma at one place in `abs()` documentation As suggested by ``@RalfJung`` here: https://github.com/rust-lang/rust/pull/124184#discussion_r1573670533
2024-04-22Add comma at one place in `abs()` documentationGurinder Singh-1/+1
2024-04-21Update stdarch submoduleBen Kimock-0/+0
2024-04-21Address more PR feedbackScott McMurray-1/+2
2024-04-21Use it in the library, and `InstSimplify` it away in the easy placesScott McMurray-8/+46
2024-04-21Add an intrinsic that lowers to AggregateKind::RawPtrScott McMurray-0/+26
2024-04-21Rollup merge of #124184 - gurry:124152-suggest-unsigned-abs-in-abs-doc, ↵Guillaume Gomez-1/+2
r=jhpratt Suggest using `unsigned_abs` in `abs` documentation Fixes #124152
2024-04-21Rollup merge of #124089 - ↵Guillaume Gomez-38/+66
simlay:fix-preadv64-and-pwritev64-link-for-watchos-and-visionos, r=workingjubilee Fix watchOS and visionOS for pread64 and pwrite64 calls In #122880, links to `preadv64` and `pwritev64` were added for `watchOS` however the underlying [`weak!` macro did not include `target_os = "watchos"`](https://github.com/rust-lang/rust/blob/c45dee5efd0c042e9d1e24559ebd0d6424d8aa70/library/std/src/sys/pal/unix/weak.rs#L30-L74). This resulted in an `xcodebuild` error when targeting `watchOS`: ``` Undefined symbols for architecture arm64: "_preadv64", referenced from: __rust_extern_with_linkage_preadv64 in libliveview_native_core.a[274](std-324fdd8d31e8eaa2.std.e18cf7e8d0336778-cgu.08.rcgu.o) "_pwritev64", referenced from: __rust_extern_with_linkage_pwritev64 in libliveview_native_core.a[274](std-324fdd8d31e8eaa2.std.e18cf7e8d0336778-cgu.08.rcgu.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` So I added them. I also went ahead and added the same for visionOS because it's bound to create the same issue.
2024-04-21Fix watchOS and visionOS for pread64 and pwrite64 callsSebastian Imlay-38/+66
* Refactor apple OSs to use pwritev and preadv rather pwritev64 and preadv64 * Updated the comments for preadv and pwritev
2024-04-21Auto merge of #123930 - Mark-Simulacrum:vec-length-invariant, r=jhprattbors-3/+5
Tell LLVM Vec::len is invariant across growth This allows LLVM to avoid re-loading it from memory.