Rollup of 6 pull requests - #163386
Rollup of 6 pull requests#163386
Conversation
Link to warning that platform-specific behavior is subject to change
with or without a const initializer, on all platforms.
It was testing diagnostics emitted for missing lifetime specifiers in `thread_local!`, but now elided lifetimes in `thread_local!` are `'static`, so there's nothing to test.
Signed-off-by: tison <wander4096@gmail.com>
Follow-up to rust-lang#151742.
…fonthey Document platform-specific behavior of `current_exe`, including that Linux can add `" (deleted)"` This documents one other OS-specific behavior that might be surprising to some users. The underlying behavior is documented in for example <https://man7.org/linux/man-pages/man5/proc_pid_exe.5.html>. Rust std docs can't and shouldn't try to cover every single OS quirk but this seems reasonably in line with telling people how to use this function, and with the text above about what happens when the exe has been renamed. This came up in the context of zed-industries/zed#46367 Fixes rust-lang#69343 (by documenting the behavior)
Allow elided ('static) lifetimes in `thread_local!`
with or without a const initializer, on all platforms.
Lifetime elision on functions includes named lifetimes and `'static` in input lifetime positions, so if we give the macro-generated `__rust_std_internal_init_fn` function an argument mentioning `'static`, then elided lifetimes in the return type default to `'static`. This uses `PhantomData<&'static ()>` so that it should probably compile down to nothing (at least in release mode).
Before this change, elided `'static` lifetimes were allowed only with `const` initializers on the "no-threads" and "native" `thread_local!` implementations, not on the "os" implementation, and not with non-`const` initializers.
After this change, they are allowed in all `thread_local!` implementations, with or without a `const` initializer (`A` and `B` both compile on targets with all three `thread_local!` implementations.)
```rs
// Const initializer
std::thread_local!(static A: &str = const { "" });
// Non-const initializer
std::thread_local!(static B: &str = "");
```
| `thread_local!` implementation | `const` initializer (`A`) | non-`const` initializer (`B`) |
| ------------- | ------------- | ---- |
| no-threads (e.g. `x86_64-unknown-uefi`) | ✅️ | ❌️ -> ✅️ |
| `target_thread_local` (e.g. `x86_64-unknown-linux-gnu`) | ✅️ | ❌️ -> ✅️ |
| os (e.g. `x86_64-pc-windows-gnu`) | ❌️ -> ✅️ | ❌️ -> ✅️ |
An alternative implementation that would only fix the inconsistency between targets, but not add support for elision with non-`const` initializers, would be to do this same thing, but only on the `os` implementation, and only if the initializer is `const` (i.e. split const initializers to a different macro arm; currently const and non-const initializers generate the same code under the `os` `thread_local!` implementation).
Fixes rust-lang#159538
Fixes rust-lang#159640 (assuming the non-`const`-initializer part of this PR is not removed)
…info, r=beetrees hir_typeck: simplify `upvar::determine_capture_info` impl
Document `rustc_abi::VariantLayout` Follow-up to rust-lang#151742. cc @saethlin @moulins @RalfJung as you were involved with the original PR
…, r=clarfonthey Stabilize SyncView This is a stabilization PR for rust-lang#98407. Closes rust-lang#98407.
Option, Result: not all arguments passed to map_or are eagerly evaluated The 2nd argument is a closure, which is lazily evaluated. I this this text was copied from other methods like `ok_or` that only have a single argument.
This comment has been minimized.
This comment has been minimized.
Rollup of 6 pull requests try-job: dist-various-1 try-job: test-various try-job: test-x86_64-gnu-aux try-job: test-x86_64-gnu-llvm-21-3 try-job: test-x86_64-msvc-1 try-job: test-aarch64-apple-1 try-job: test-aarch64-apple-2 try-job: test-x86_64-mingw-1 try-job: test-i686-msvc try-job: test-armhf-gnu
This comment has been minimized.
This comment has been minimized.
…uwer Rollup of 6 pull requests Successful merges: - #150824 (Document platform-specific behavior of `current_exe`, including that Linux can add `" (deleted)"`) - #159564 (Allow elided ('static) lifetimes in `thread_local!`) - #163026 (hir_typeck: simplify `upvar::determine_capture_info` impl) - #163256 (Document `rustc_abi::VariantLayout`) - #163366 (Stabilize SyncView) - #163376 (Option, Result: not all arguments passed to map_or are eagerly evaluated)
|
💔 Test for 895d5ee failed: CI. Failed job:
|
|
@bors retry |
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 0b80633 (parent) -> 75a75c3 (this PR) Test differencesShow 54 test diffsStage 1
Stage 2
Additionally, 39 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 75a75c3e0a67d3fa3d03982775f5bb0356e7b510 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (75a75c3): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 2.5%, secondary 2.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.1%, secondary 0.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 491.179s -> 487.818s (-0.68%) |
|
📌 Perf builds for each rolled up PR:
parent commit: 0b80633005 In the case of a perf regression, run the following command with the SHAs of each PR you suspect might be the cause: |
Successful merges:
current_exe, including that Linux can add" (deleted)"#150824 (Document platform-specific behavior ofcurrent_exe, including that Linux can add" (deleted)")thread_local!#159564 (Allow elided ('static) lifetimes inthread_local!)upvar::determine_capture_infoimpl #163026 (hir_typeck: simplifyupvar::determine_capture_infoimpl)rustc_abi::VariantLayout#163256 (Documentrustc_abi::VariantLayout)r? @ghost
Create a similar rollup