Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit fec2276

Browse files
Account for flags in const folders
1 parent 70dab5a commit fec2276

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

compiler/rustc_middle/src/ty/abstract_const.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ impl<'tcx> TyCtxt<'tcx> {
6363
},
6464
_ => c,
6565
};
66-
ct.super_fold_with(self)
66+
67+
if ct.has_type_flags(ty::TypeFlags::HAS_CT_PROJECTION) {
68+
ct.super_fold_with(self)
69+
} else {
70+
ct
71+
}
6772
}
6873
}
6974
ac.fold_with(&mut Expander { tcx: self })

compiler/rustc_trait_selection/src/traits/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,22 @@ pub fn normalize_param_env_or_error<'tcx>(
376376

377377
c
378378
}
379+
380+
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
381+
if t.has_type_flags(ty::TypeFlags::HAS_CT_PROJECTION) {
382+
t.super_fold_with(self)
383+
} else {
384+
t
385+
}
386+
}
387+
388+
fn fold_predicate(&mut self, p: ty::Predicate<'tcx>) -> ty::Predicate<'tcx> {
389+
if p.has_type_flags(ty::TypeFlags::HAS_CT_PROJECTION) {
390+
p.super_fold_with(self)
391+
} else {
392+
p
393+
}
394+
}
379395
}
380396

381397
// This whole normalization step is a hack to work around the fact that

0 commit comments

Comments
 (0)