]> git.lizzy.rs Git - rust.git/commit
move fast reject test out of `SelectionContext::match_impl`.
authorlcnr <rust@lcnr.de>
Tue, 24 May 2022 07:22:24 +0000 (09:22 +0200)
committerlcnr <rust@lcnr.de>
Wed, 25 May 2022 05:40:38 +0000 (07:40 +0200)
commitbff7b5130d49da7c86d688843292c10b82a4e6a0
treed87c08d76572f005112a6fa98cccca2ff09aeaa5
parenta76277c6c4cd7f175efd2d86477447bd6577aea2
move fast reject test out of `SelectionContext::match_impl`.

`match_impl` has two call sites. For one of them (within `rematch_impl`)
the fast reject test isn't necessary, because any rejection would
represent a compiler bug.

This commit moves the fast reject test to the other `match_impl` call
site, in `assemble_candidates_from_impls`. This lets us move the fast
reject test outside the `probe` call in that function. This avoids the
taking of useless snapshots when the fast reject test succeeds, which
gives a performance win when compiling the `bitmaps` and `nalgebra`
crates.

Co-authored-by: name <n.nethercote@gmail.com>
compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs
compiler/rustc_trait_selection/src/traits/select/mod.rs