Skip to content

Commit 80a943b

Browse files
Do not add Sized predicates twice for parents
1 parent 3f0a563 commit 80a943b

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

crates/hir-ty/src/lower.rs

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1826,25 +1826,16 @@ where
18261826
));
18271827
predicates.push(clause);
18281828
};
1829-
if generics.parent_generics().is_some_and(|parent| filter(parent.def())) {
1830-
generics.iter_parent().enumerate().for_each(
1831-
|(param_idx, (param_id, param_data))| {
1832-
add_sized_clause(param_idx as u32, param_id, param_data);
1833-
},
1834-
);
1835-
}
1836-
if filter(def) {
1837-
let parent_params_len = generics.len_parent();
1838-
generics.iter_self().enumerate().for_each(
1839-
|(param_idx, (param_id, param_data))| {
1840-
add_sized_clause(
1841-
(param_idx + parent_params_len) as u32,
1842-
param_id,
1843-
param_data,
1844-
);
1845-
},
1846-
);
1847-
}
1829+
let parent_params_len = maybe_parent_generics.len_parent();
1830+
maybe_parent_generics.iter_self().enumerate().for_each(
1831+
|(param_idx, (param_id, param_data))| {
1832+
add_sized_clause(
1833+
(param_idx + parent_params_len) as u32,
1834+
param_id,
1835+
param_data,
1836+
);
1837+
},
1838+
);
18481839
}
18491840

18501841
// We do not clear `ctx.unsized_types`, as the `?Sized` clause of a child (e.g. an associated type) can

0 commit comments

Comments
 (0)