1
Fork 0

anonymize all bound vars, not just regions

This commit is contained in:
lcnr 2022-07-25 20:24:13 +02:00
parent fd59d058ec
commit c3fce8e937
7 changed files with 95 additions and 13 deletions

View file

@ -71,7 +71,7 @@ where
if var_values.var_values.is_empty() {
value
} else {
let delegate = FnMutDelegate {
let mut delegate = FnMutDelegate {
regions: |br: ty::BoundRegion| match var_values.var_values[br.var].unpack() {
GenericArgKind::Lifetime(l) => l,
r => bug!("{:?} is a region but value is {:?}", br, r),
@ -86,6 +86,6 @@ where
},
};
tcx.replace_escaping_bound_vars_uncached(value, delegate)
tcx.replace_escaping_bound_vars_uncached(value, &mut delegate)
}
}

View file

@ -11,7 +11,7 @@ pub fn anonymize_predicate<'tcx>(
tcx: TyCtxt<'tcx>,
pred: ty::Predicate<'tcx>,
) -> ty::Predicate<'tcx> {
let new = tcx.anonymize_late_bound_regions(pred.kind());
let new = tcx.anonymize_bound_vars(pred.kind());
tcx.reuse_or_mk_predicate(pred, new)
}
@ -334,7 +334,7 @@ pub fn transitive_bounds_that_define_assoc_type<'tcx>(
std::iter::from_fn(move || {
while let Some(trait_ref) = stack.pop() {
let anon_trait_ref = tcx.anonymize_late_bound_regions(trait_ref);
let anon_trait_ref = tcx.anonymize_bound_vars(trait_ref);
if visited.insert(anon_trait_ref) {
let super_predicates = tcx.super_predicates_that_define_assoc_type((
trait_ref.def_id(),