Repository navigation
avoid trivial fn map_bound validations - #163638
Merged
Merged
Conversation
Collaborator
|
r? @oli-obk rustbot has assigned @oli-obk. Use Why was this reviewer chosen?The reviewer was selected based on:
|
oli-obk
approved these changes
Oct 2, 2026
Contributor
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 2, 2026
…uwer Rollup of 9 pull requests Successful merges: - #163655 (explicitly handle tests that pass with -Znext-solver) - #159924 (Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc) - #163572 (Update the minimum external LLVM to 22) - #129822 (Docs - type guarantees update) - #157973 (Distinguish `repr(C)` ZSTs from others in ABI compatibility rules) - #162332 (preserve overflow in builtin Field candidates) - #163574 (intrinsics: Rename `abort` to `abort_immediate`) - #163638 (avoid trivial `fn map_bound` validations) - #163660 (yeet compare-mode-coherence)
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 3, 2026
…uwer Rollup of 9 pull requests Successful merges: - #163655 (explicitly handle tests that pass with -Znext-solver) - #159924 (Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc) - #163572 (Update the minimum external LLVM to 22) - #129822 (Docs - type guarantees update) - #157973 (Distinguish `repr(C)` ZSTs from others in ABI compatibility rules) - #162332 (preserve overflow in builtin Field candidates) - #163574 (intrinsics: Rename `abort` to `abort_immediate`) - #163638 (avoid trivial `fn map_bound` validations) - #163660 (yeet compare-mode-coherence)
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 3, 2026
Rollup merge of #163638 - lcnr:map-bound-no-validate, r=oli-obk avoid trivial `fn map_bound` validations when compiling `zerocopy` a lot of time is spent simply checking the bound vars in `Clause::kind` because it does ```rust self.0.internee.map_bound(|kind| match kind { PredicateKind::Clause(clause) => clause, _ => unreachable!(), }) ``` let's make performance with `debug_assertions` a bit better: `zerocopy` with `-Znext-solver`: ``` 16884862 counts ( 1) 12189626 (72.2%, 72.2%): Binder::map_bound called at compiler/rustc_middle/src/ty/predicate.rs:174:25 ( 2) 1853971 (11.0%, 83.2%): Binder::map_bound called at compiler/rustc_type_ir/src/binder.rs:89:14 ( 3) 1443803 ( 8.6%, 91.7%): Binder::map_bound called at compiler/rustc_type_ir/src/inherent.rs:493:14 ( 4) 572570 ( 3.4%, 95.1%): Binder::map_bound called at compiler/rustc_type_ir/src/predicate.rs:234:14 ( 5) 272733 ( 1.6%, 96.7%): Binder::map_bound called at compiler/rustc_type_ir/src/inherent.rs:507:14 ( 6) 184934 ( 1.1%, 97.8%): Binder::map_bound called at compiler/rustc_middle/src/ty/predicate.rs:523:14 ( 7) 183998 ( 1.1%, 98.9%): Binder::map_bound called at compiler/rustc_type_ir/src/predicate.rs:251:14 ``` `zerocopy` with `-Znext-solver=no` ``` 13476410 counts ( 1) 9906183 (73.5%, 73.5%): Binder::map_bound called at compiler/rustc_middle/src/ty/predicate.rs:174:25 ( 2) 2107825 (15.6%, 89.1%): Binder::map_bound called at compiler/rustc_type_ir/src/binder.rs:89:14 ( 3) 376524 ( 2.8%, 91.9%): Binder::map_bound called at compiler/rustc_type_ir/src/inherent.rs:493:14 ( 4) 321976 ( 2.4%, 94.3%): Binder::map_bound called at compiler/rustc_type_ir/src/predicate.rs:251:14 ( 5) 262305 ( 1.9%, 96.3%): Binder::map_bound called at compiler/rustc_middle/src/ty/predicate.rs:523:14 ( 6) 84143 ( 0.6%, 96.9%): Binder::map_bound called at compiler/rustc_infer/src/infer/outlives/verify.rs:49:47 ( 7) 83876 ( 0.6%, 97.5%): Binder::map_bound called at compiler/rustc_infer/src/traits/mod.rs:183:24 ``` compiling `std`: ``` 32803629 counts ( 1) 12234204 (37.3%, 37.3%): Binder::map_bound called at compiler/rustc_type_ir/src/binder.rs:89:14 ( 2) 9624749 (29.3%, 66.6%): Binder::map_bound called at compiler/rustc_middle/src/ty/predicate.rs:174:25 ( 3) 3805442 (11.6%, 78.2%): Binder::map_bound called at compiler/rustc_type_ir/src/inherent.rs:493:14 ( 4) 2542468 ( 7.8%, 86.0%): Binder::map_bound called at compiler/rustc_type_ir/src/predicate.rs:234:14 ( 5) 1229480 ( 3.7%, 89.7%): Binder::map_bound called at compiler/rustc_middle/src/ty/predicate.rs:523:14 ( 6) 1176716 ( 3.6%, 93.3%): Binder::map_bound called at compiler/rustc_type_ir/src/predicate.rs:251:14 ( 7) 385823 ( 1.2%, 94.5%): Binder::map_bound called at compiler/rustc_type_ir/src/inherent.rs:507:14 ``` Could spend more effort to avoid the validation in trivial `Binder::fold_with`, but that's not worth it I think. cc https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/casual.20chat.20and.20support/near/628479010
github-actions Bot
pushed a commit
to rust-lang/stdarch
that referenced
this pull request
Oct 5, 2026
…uwer Rollup of 9 pull requests Successful merges: - rust-lang/rust#163655 (explicitly handle tests that pass with -Znext-solver) - rust-lang/rust#159924 (Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc) - rust-lang/rust#163572 (Update the minimum external LLVM to 22) - rust-lang/rust#129822 (Docs - type guarantees update) - rust-lang/rust#157973 (Distinguish `repr(C)` ZSTs from others in ABI compatibility rules) - rust-lang/rust#162332 (preserve overflow in builtin Field candidates) - rust-lang/rust#163574 (intrinsics: Rename `abort` to `abort_immediate`) - rust-lang/rust#163638 (avoid trivial `fn map_bound` validations) - rust-lang/rust#163660 (yeet compare-mode-coherence)
github-actions Bot
pushed a commit
to rust-lang/rustc-dev-guide
that referenced
this pull request
Oct 5, 2026
…uwer Rollup of 9 pull requests Successful merges: - rust-lang/rust#163655 (explicitly handle tests that pass with -Znext-solver) - rust-lang/rust#159924 (Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc) - rust-lang/rust#163572 (Update the minimum external LLVM to 22) - rust-lang/rust#129822 (Docs - type guarantees update) - rust-lang/rust#157973 (Distinguish `repr(C)` ZSTs from others in ABI compatibility rules) - rust-lang/rust#162332 (preserve overflow in builtin Field candidates) - rust-lang/rust#163574 (intrinsics: Rename `abort` to `abort_immediate`) - rust-lang/rust#163638 (avoid trivial `fn map_bound` validations) - rust-lang/rust#163660 (yeet compare-mode-coherence)
programskillforverification
pushed a commit
to programskillforverification/miri
that referenced
this pull request
Oct 5, 2026
…uwer Rollup of 9 pull requests Successful merges: - rust-lang/rust#163655 (explicitly handle tests that pass with -Znext-solver) - rust-lang/rust#159924 (Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc) - rust-lang/rust#163572 (Update the minimum external LLVM to 22) - rust-lang/rust#129822 (Docs - type guarantees update) - rust-lang/rust#157973 (Distinguish `repr(C)` ZSTs from others in ABI compatibility rules) - rust-lang/rust#162332 (preserve overflow in builtin Field candidates) - rust-lang/rust#163574 (intrinsics: Rename `abort` to `abort_immediate`) - rust-lang/rust#163638 (avoid trivial `fn map_bound` validations) - rust-lang/rust#163660 (yeet compare-mode-coherence)
AzureXuanVerse
pushed a commit
to AzureXuanVerse/rustfmt
that referenced
this pull request
Oct 7, 2026
…uwer Rollup of 9 pull requests Successful merges: - rust-lang/rust#163655 (explicitly handle tests that pass with -Znext-solver) - rust-lang/rust#159924 (Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc) - rust-lang/rust#163572 (Update the minimum external LLVM to 22) - rust-lang/rust#129822 (Docs - type guarantees update) - rust-lang/rust#157973 (Distinguish `repr(C)` ZSTs from others in ABI compatibility rules) - rust-lang/rust#162332 (preserve overflow in builtin Field candidates) - rust-lang/rust#163574 (intrinsics: Rename `abort` to `abort_immediate`) - rust-lang/rust#163638 (avoid trivial `fn map_bound` validations) - rust-lang/rust#163660 (yeet compare-mode-coherence)
bjorn3
pushed a commit
to rust-lang/rustc_codegen_cranelift
that referenced
this pull request
Oct 8, 2026
…uwer Rollup of 9 pull requests Successful merges: - rust-lang/rust#163655 (explicitly handle tests that pass with -Znext-solver) - rust-lang/rust#159924 (Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc) - rust-lang/rust#163572 (Update the minimum external LLVM to 22) - rust-lang/rust#129822 (Docs - type guarantees update) - rust-lang/rust#157973 (Distinguish `repr(C)` ZSTs from others in ABI compatibility rules) - rust-lang/rust#162332 (preserve overflow in builtin Field candidates) - rust-lang/rust#163574 (intrinsics: Rename `abort` to `abort_immediate`) - rust-lang/rust#163638 (avoid trivial `fn map_bound` validations) - rust-lang/rust#163660 (yeet compare-mode-coherence)
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.
when compiling
zerocopya lot of time is spent simply checking the bound vars inClause::kindbecause it doeslet's make performance with
debug_assertionsa bit better:zerocopywith-Znext-solver:zerocopywith-Znext-solver=nocompiling
std:Could spend more effort to avoid the validation in trivial
Binder::fold_with, but that's not worth it I think.cc https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/casual.20chat.20and.20support/near/628479010