Repository navigation
Rollup of 10 pull requests - #163969
Closed
JonathanBrouwer wants to merge 24 commits into
Closed
Rollup of 10 pull requests#163969JonathanBrouwer wants to merge 24 commits into
JonathanBrouwer wants to merge 24 commits into
Conversation
This prevents nonsensical combinations like unsized+on_stack and forces all users to explicitly handle the difference between sized and unsized arguments. In a couple of places unsized arguments were handled incorrectly if they would ever manage to reach that code.
When `TypeVisitable` is implemented but `GenericTypeVisitable` isn't,
the lint (which we'll add soon) recommends adding
`#[derive(GenericTypeVisitable)]`. However, this suggestion is incorrect
for types whose impls ought to be trivial. There, the problem occurs
because the type was added to `TrivialTypeTraversalImpls!` in
`macros.rs`, which added the `TypeVisitable` impl, but wasn't added to
`trivial_impls!` in `generic_visit.rs`, such that the
`GenericTypeVisitable` impl wasn't added.
Imo, the root cause of this problem is that we have two separate macros
for adding trivial impls. So this commit merges them into one, by making
`TrivialTypeTraversalImpls!` add a `GenericTypeVisitable` impl as well.
RE: `Variance`: its `GenericTypeVisitable` impl is now provided by
`TrivialTypeTraversalImpls!`, making the derive unnecessary.
RE: `rustc_hash::FxBuildHasher`: its `GenericTypeVisitable` impl ended
up being removed, because `TypeVisitable` can't be implemented due to it
not implemnting `Debug`. This shouldn't be a problem however, as
`{Generic,}TypeVisitable` should always be implemented in pairs anyway.
I confirmed this by removing the impl from `ra-ap-rustc_type_ir` and
`cargo check`-ing r-a.
The missing impl for arrays was (indirectly) highlighted by the test suite, the rest -- by the `#[deny]`
This will make it easier to move them in a subsequent commit, since `UnrollAttr` implements `PartialEq`. If, in the future, we add more kinds of loop hints, this can become a small enum wrapping only those attr types.
We should not disable the pattern in MatchBranchSimplification. The two forms exhaustive match and cast are equivalent, but the cast is better represented in MIR: no branches, only one statement. AFAIK, LLVM does not handle multiple disjoint intervals well. As an workaround, the patch emits `assume(ctpop(val) == 1)` to tell LLVM that the discriminant is a power of two.
Only the `Goto` variant uses `loop_hint_attrs`, so other variants shouldn't pay the cost. This shrinks `Terminator` and thus `BasicBlockData` by 8 bytes, and also simplifies many users of `Terminator`. Every byte saved from `BasicBlockData` makes a big difference in max-rss. For aws-sdk-ec2 full check, this saves 34.1 MiB (~0.62% of its peak RSS) Add a `TerminatorKind::goto` helper function for convenient construction with a target and no hints. With that helper available, most of this commit is simple, straightforward, mechanical translations of construction or pattern matching. The only notable changes are: - `compiler/rustc_codegen_ssa/src/mir/block.rs` actually uses the moved hints. - `compiler/rustc_middle/src/mir/mod.rs` updates the size assertions. - `compiler/rustc_mir_build/src/builder/cfg.rs` adds/updates helpers. - `compiler/rustc_mir_build/src/builder/expr/into.rs` has the one place that creates a `Goto` with non-empty hints.
… r=saethlin codegen: tell LLVM that the discriminant is a power of two Fixes rust-lang#162513. We should not disable the pattern in MatchBranchSimplification. The two forms exhaustive match and cast are equivalent, but the cast is better represented in MIR: no branches, only one statement. AFAIK, LLVM does not handle multiple disjoint intervals well. As an workaround, the patch emits `assume(ctpop(val) == 1)` to tell LLVM that the discriminant is a power of two. LLM disclosure: search the codebase and fix grammer.
… r=beetrees Split PassMode::IndirectUnsized out of PassMode::Indirect This prevents nonsensical combinations like unsized+on_stack and forces all users to explicitly handle the difference between sized and unsized arguments. In a couple of places unsized arguments were handled incorrectly if they would ever manage to reach that code.
…n-goto, r=saethlin Move `loop_hint_attrs` from `Terminator` into `TerminatorKind::Goto` Only the `Goto` variant uses `loop_hint_attrs`, so other variants shouldn't pay the cost. This shrinks `Terminator` and thus `BasicBlockData` by 8 bytes, and also simplifies many users of `Terminator`. Every byte saved from `BasicBlockData` makes a big difference in max-rss. For aws-sdk-ec2 full check, this saves 34.1 MiB (~0.62% of its peak RSS) Add a `TerminatorKind::goto` helper function for convenient construction with a target and no hints. With that helper available, most of this commit is simple, straightforward, mechanical translations of construction or pattern matching. The only notable changes are: - `compiler/rustc_codegen_ssa/src/mir/block.rs` actually uses the moved hints. - `compiler/rustc_middle/src/mir/mod.rs` updates the size assertions. - `compiler/rustc_mir_build/src/builder/cfg.rs` adds/updates helpers. - `compiler/rustc_mir_build/src/builder/expr/into.rs` has the one place that creates a `Goto` with non-empty hints. --- I have several more potential improvements to basic block sizes, but this one was an easy starting point.
…useZ4 autodiff: fix sysroot candidates in libEnzyme not found error fix: rust-lang#160335 (comment) Before ```shell RUSTFLAGS="-Zautodiff=Enable" cargo +enzyme run info: `cargo` is unavailable for the active toolchain info: falling back to "/home/gh-sgasho/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo" error: failed to run `rustc` to learn about target-specific information Caused by: process didn't exit successfully: `/home/gh-sgasho/.rustup/toolchains/enzyme/bin/rustc - --crate-name ___ --print=file-names -Zautodiff=Enable --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=split-debuginfo --print=crate-name --print=cfg -Wwarnings` (exit status: 1) --- stderr error: autodiff backend not found in the sysroot: failed to find a `libEnzyme-23` folder in the sysroot candidates: * /home/gh-sgasho/rust-worktrees/enzyme-wrapper-cleanup/build/x86_64-unknown-linux-gnu/stage1/lib | = note: it will be distributed via rustup in the future ``` After: points out the right candidate dir ```shell RUSTFLAGS="-Zautodiff=Enable" cargo +enzyme run --release info: `cargo` is unavailable for the active toolchain info: falling back to "/home/gh-sgasho/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo" error: failed to run `rustc` to learn about target-specific information Caused by: process didn't exit successfully: `/home/gh-sgasho/.rustup/toolchains/enzyme/bin/rustc - --crate-name ___ --print=file-names -Zautodiff=Enable --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=split-debuginfo --print=crate-name --print=cfg -Wwarnings` (exit status: 1) --- stderr error: autodiff backend not found in the sysroot: failed to find a `libEnzyme-23.so` in the sysroot candidates: * /home/gh-sgasho/rust-worktrees/enzyme-wrapper-cleanup/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib | = note: it will be distributed via rustup in the future ``` I also verified that sample autodiff code ran successfully using local build, without breaking anything. r? @ZuseZ4
…le, r=JonathanBrouwer Add `rustc::missing_generic_type_visitable` lint Best reviewed commit-by-commit. The CI will probably complain about the TODOs, but I've added them deliberately, as a way to ask questions. r? @JonathanBrouwer cc @rust-lang/rust-analyzer
…Urgau [rustdoc] Fix more `incoherent_impl` linking Hopefully last fix for rust-lang#162808. We force the correct crate to be linked when generating the external location based on the `DefId` crate. I'm actually surprised it wasn't an issue before. Oh well. r? @Urgau
Use BasicBlock::start_location and Location::START Construct special MIR locations concisely.
…wesleywiser relax_elf_relocations is x86-only The flag ends up here https://github.com/rust-lang/rust/blob/8d1a76430406c877b35d0b627e7f796dcf0dfeca/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp#L393 The LLVM name for this, `X86RelaxRelocations`, makes me believe that this is x86-only. So let's at least document that on our side as well. Cc @bjorn3 @nikic
Member
Author
Contributor
This comment has been minimized.
This comment has been minimized.
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 8, 2026
Rollup of 10 pull requests try-job: dist-various-1 try-job: test-various try-job: test-x86_64-gnu-aux 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.
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 8, 2026
…uwer Rollup of 10 pull requests Successful merges: - #162741 (codegen: tell LLVM that the discriminant is a power of two) - #162758 (Split PassMode::IndirectUnsized out of PassMode::Indirect) - #163931 (Move `loop_hint_attrs` from `Terminator` into `TerminatorKind::Goto`) - #163028 (autodiff: fix sysroot candidates in libEnzyme not found error) - #163538 (Add `rustc::missing_generic_type_visitable` lint) - #163841 ([rustdoc] Fix more `incoherent_impl` linking) - #163908 (Update Enzyme submodule) - #163935 (Use BasicBlock::start_location and Location::START) - #163949 (disable next-solver with higher-ranked-assumptions) - #163951 (relax_elf_relocations is x86-only)
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Contributor
|
💔 Test for 753332a failed: CI. Failed job:
|
Contributor
|
PR #163538, which is a member of this rollup, was unapproved. |
Contributor
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:
loop_hint_attrsfromTerminatorintoTerminatorKind::Goto#163931 (Moveloop_hint_attrsfromTerminatorintoTerminatorKind::Goto)rustc::missing_generic_type_visitablelint #163538 (Addrustc::missing_generic_type_visitablelint)incoherent_impllinking #163841 ([rustdoc] Fix moreincoherent_impllinking)r? @ghost
Create a similar rollup