Rollup of 23 pull requests#154226
Closed
JonathanBrouwer wants to merge 55 commits intorust-lang:mainfrom
Closed
Conversation
In CI, the receiver thread can be descheduled for a surprisingly long time, so there's no guarantee that a timeout actually occurs.
Instead of relying on the linker to find the 'environ' symbol, use dlsym. Fixes rust-lang#153451 Sponsored by: ConnectWise
Currently, building std for a custom Wasm target with an OS other than `unknown` will fail, because `sys/alloc/mod.rs` will attempt to use `sys/alloc/wasm.rs`, the dlmalloc-based allocator used on `wasm32-unknown-unknown`. However, currently dlmalloc is only pulled in when `target_os = "unknown"`. Instead, we should make `Cargo.toml` and `alloc/mod.rs` match: either - disable `wasm.rs` in `alloc/mod.rs` where `not(target_os = "unknown")`, or - pull in `dlmalloc` for all Wasm targets with `target_family = "wasm32"` that aren't covered by the [upper branches of `alloc/mod.rs`](https://github.com/rust-lang/rust/blob/main/library/std/src/sys/alloc/mod.rs#L72-L100). This PR takes the latter approach, because it allows more code to compile without a custom allocator.
Add a HasAttrs<'tcx, Tcx> trait to rustc_hir that allows find_attr! to accept DefId, LocalDefId, OwnerId, and HirId directly, instead of requiring callers to manually fetch the attribute slice first. The trait is defined in rustc_hir with a generic Tcx parameter to avoid a dependency cycle (rustc_hir cannot depend on rustc_middle). The four concrete impls for TyCtxt are in rustc_middle.
…d documentation + tests
This improves startup performance by 16%, shown by an optimized hello-world program. glibc's `pthread_getattr_np` performs expensive syscalls when reading `/proc/self/maps`. That is all wasted with `panic = immediate-abort` active because `init()` immediately discards the return value from `install_main_guard()`. A similar improvement can be seen in environments that don't have `/proc`. This change is safe because the immediately succeeding comment says that we rely on Linux's "own stack-guard mechanism".
Avoid an ICE for:
struct A;
impl A<B> {}
The compiler no longer panics and can proceed to emit existing diagnostics.
Adds `tests/ui/missing/undeclared-generic-parameter.rs`.
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Now that the tracking issue has been opened, point to it.
- `char::is_cased` - `char::is_titlecase` - `char::case` - `char::to_titlecase`
When a function's documentation has to explain the meaning of nested results and options, then it is often a good candidate for using a custom result enum instead. This commit also renames `DepNodeColorMap::try_mark` to `try_set_color`, to make it more distinct from the similarly-named `DepGraph::try_mark_green`. The difference is that `try_mark_green` is a higher-level operation that tries to determine whether a node _can_ be marked green, whereas `try_set_color` is a lower-level operation that actually records a color for the node.
This method is only used to initialize the always-red node, which can be done with `try_set_color` instead.
…dPthreadGetattrNp, r=Mark-Simulacrum Skip stack_start_aligned for immediate-abort This improves startup performance by 16%, shown by an optimized hello-world program. glibc's `pthread_getattr_np` performs expensive syscalls when reading `/proc/self/maps`. That is all wasted with `panic = immediate-abort` active because `init()` immediately discards the return value from `install_main_guard()`. A similar improvement can be seen in environments that don't have `/proc`. This change is safe because the immediately succeeding comment says that we rely on Linux's "own stack-guard mechanism". Tracking issue: rust-lang#147286 # Benchmark Set it up with `cargo new hello-world2`, and replace these files: ```toml # Cargo.toml cargo-features = ["panic-immediate-abort"] [package] name = "hello-world" version = "0.1.0" edition = "2024" [profile.release] lto = true panic = "immediate-abort" codegen-units = 1 opt-level = "z" strip = true # .cargo/config.toml [unstable] build-std = ["std"] ``` ## Before ```console home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2 Benchmark 1: target/release/hello-world2 Time (mean ± σ): 524.8 µs ± 65.1 µs [User: 276.1 µs, System: 187.0 µs] Range (min … max): 446.4 µs … 975.5 µs 3996 runs home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2 Benchmark 1: target/release/hello-world2 Time (mean ± σ): 519.4 µs ± 65.8 µs [User: 282.1 µs, System: 177.7 µs] Range (min … max): 443.2 µs … 830.5 µs 3612 runs home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2 Benchmark 1: target/release/hello-world2 Time (mean ± σ): 520.0 µs ± 64.3 µs [User: 277.1 µs, System: 182.1 µs] Range (min … max): 447.1 µs … 1001.3 µs 3804 runs ``` For a visualization of the problem, run `cargo +stage1 build --release && perf record --call-graph dwarf -F max ./target/release/hello-world2 && perf script | inferno-collapse-perf | inferno-flamegraph > flamegraph.svg`: <img width="3832" height="1216" alt="flamegraph with 17.41% __pthread_getattr_np" src="https://github.com/user-attachments/assets/acc2286e-1582-4772-9e3b-68b5c35e3e70" /> ## After ```console home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2Benchmark 1: target/release/hello-world2 Time (mean ± σ): 444.7 µs ± 57.3 µs [User: 257.4 µs, System: 130.2 µs] Range (min … max): 379.4 µs … 1289.3 µs 3893 runs Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options. home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2 Benchmark 1: target/release/hello-world2 Time (mean ± σ): 452.3 µs ± 60.7 µs [User: 261.5 µs, System: 133.5 µs] Range (min … max): 374.9 µs … 1512.4 µs 4177 runs Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options. home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2 Benchmark 1: target/release/hello-world2 Time (mean ± σ): 441.2 µs ± 56.1 µs [User: 256.2 µs, System: 128.8 µs] Range (min … max): 375.0 µs … 760.4 µs 4032 runs ```
…=Mark-Simulacrum implement `BinaryHeap::as_mut_slice` Tracking issue: rust-lang#154009
…ts, r=Kivooeo
ui/lto: move and rename two tests from issues/
Move:
- `tests/ui/issues/issue-44056.rs` -> `tests/ui/lto/lto-avx-target-feature.rs`
- The first test enables both AVX target features and LTO but does not exercise AVX-specific behavior. The test primarily checks that LTO builds successfully with these flags; place it under `ui/lto` for consistency.
- `tests/ui/issues/issue-51947.rs` -> `tests/ui/lto/lto-weak-merge-functions.rs`
- The second test exercises weak linkage interacting with LTO (merge-functions), so it should belong in `ui/lto`.
I have also added a commented line at the top of each test file indicating the issue it originated from.
…Brouwer allow `incomplete_features` in most UI tests This PR allows the `incomplete_features` lint for all UI tests except for the three directories with the largest number of tests (`traits`, `specialization` and `const-generics`) triggering this lint to keep the size of this PR manageable. The remaining three directories will be handled in followup PRs. Part of rust-lang#154168.
…ulacrum Add new alias for Guillaume Gomez email address I'm switching to a new email account and slowly updating all references to the old one.
…tebank
diagnostics: avoid ICE for undeclared generic parameter in impl
Avoid an ICE for:
struct A;
impl A<B> {}
The compiler no longer panics and can proceed to emit existing diagnostics.
Adds `tests/ui/missing/undeclared-generic-parameter.rs`.
Fixes rust-lang#154165 and introduced by rust-lang#152913
…o_the_tracking_issue, r=JonathanBrouwer Update the tracking issue for #[diagnostic::on_move] PR rust-lang#150935 has been merged and then I have opened the tracking issue (whoops ?). So this update `compiler/rustc_feature/src/unstable.rs` to point to the right tracking issue. This is related to the tracking issue rust-lang#154181
Use enums to clarify `DepNodeColorMap` color marking When a function's documentation has to explain the meaning of nested results and options, then it is often a good candidate for using a custom result enum instead. This PR also renames `DepNodeColorMap::try_mark` to `try_set_color`, to make it more distinct from the similarly-named `DepGraph::try_mark_green`. The difference is that `try_mark_green` is a higher-level operation that tries to determine whether a node _can_ be marked green, whereas `try_set_color` is a lower-level operation that actually records a colour for the node. The updated docs for `try_set_color` also fix a typo: *atomicaly* → *atomically*. r? nnethercote (or compiler)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
std: includedlmallocfor all non-wasi Wasm targets #153686 (std: includedlmallocfor all non-wasi Wasm targets)got_timeoutassert from two channel tests #153534 (Remove a flakygot_timeoutassert from two channel tests)target.abitotarget.cfg_abiand enum-ify llvm_abiname #153857 (Renametarget.abitotarget.cfg_abiand enum-ify llvm_abiname)freeze_*methods toOpenOptionsExt2#153491 (Movefreeze_*methods toOpenOptionsExt2)sys::pal::ostosys::paths#153623 (std: movesys::pal::ostosys::paths)BinaryHeap::as_mut_slice#154011 (implementBinaryHeap::as_mut_slice)incomplete_featuresin most UI tests #154174 (allowincomplete_featuresin most UI tests)DepNodeColorMapcolor marking #154201 (Use enums to clarifyDepNodeColorMapcolor marking )r? @ghost
Create a similar rollup