1
Fork 0

Rollup merge of #106648 - Nilstrieb:poly-cleanup, r=compiler-errors

Polymorphization cleanup

Split out of #106233

Use a newtype instead of a bitset directly. This makes the code way easier to read and easier to adapt for future changes.
This commit is contained in:
nils 2023-01-11 17:30:55 +01:00 committed by GitHub
commit 6e0c404f76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 66 additions and 79 deletions

View file

@ -40,12 +40,11 @@ where
let index = index
.try_into()
.expect("more generic parameters than can fit into a `u32`");
let is_used = unused_params.contains(index).map_or(true, |unused| !unused);
// Only recurse when generic parameters in fns, closures and generators
// are used and require substitution.
// Just in case there are closures or generators within this subst,
// recurse.
if is_used && subst.needs_subst() {
if unused_params.is_used(index) && subst.needs_subst() {
return subst.visit_with(self);
}
}