Skip to content

Commit 7cbfa2e

Browse files
committed
rebase
1 parent eb5bbab commit 7cbfa2e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

compiler/rustc_trait_selection/src/traits/query/normalize.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ impl<'cx, 'tcx> AtExt<'tcx> for At<'cx, 'tcx> {
7878
// The rest of the code is already set up to be lazy about replacing bound vars,
7979
// and only when we actually have to normalize.
8080
if value.has_escaping_bound_vars() {
81-
let mut max_visitor =
82-
MaxEscapingBoundVarVisitor { outer_index: ty::INNERMOST, escaping: 0 };
81+
let mut max_visitor = MaxEscapingBoundVarVisitor {
82+
tcx: self.infcx.tcx,
83+
outer_index: ty::INNERMOST,
84+
escaping: 0,
85+
};
8386
value.visit_with(&mut max_visitor);
8487
if max_visitor.escaping > 0 {
8588
normalizer.universes.extend((0..max_visitor.escaping).map(|_| None));
@@ -106,13 +109,18 @@ impl<'cx, 'tcx> AtExt<'tcx> for At<'cx, 'tcx> {
106109
}
107110

108111
/// Visitor to find the maximum escaping bound var
109-
struct MaxEscapingBoundVarVisitor {
112+
struct MaxEscapingBoundVarVisitor<'tcx> {
113+
tcx: TyCtxt<'tcx>,
110114
// The index which would count as escaping
111115
outer_index: ty::DebruijnIndex,
112116
escaping: usize,
113117
}
114118

115-
impl<'tcx> TypeVisitor<'tcx> for MaxEscapingBoundVarVisitor {
119+
impl<'tcx> TypeVisitor<'tcx> for MaxEscapingBoundVarVisitor<'tcx> {
120+
fn tcx_for_anon_const_substs(&self) -> Option<TyCtxt<'tcx>> {
121+
Some(self.tcx)
122+
}
123+
116124
fn visit_binder<T: TypeFoldable<'tcx>>(
117125
&mut self,
118126
t: &ty::Binder<'tcx, T>,

0 commit comments

Comments
 (0)