Skip to content

Commit f0434cc

Browse files
committed
Remove some remnants
1 parent 1372123 commit f0434cc

File tree

2 files changed

+5
-41
lines changed

2 files changed

+5
-41
lines changed

compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -303,34 +303,16 @@ struct Canonicalizer<'cx, 'tcx> {
303303
sub_root_lookup_table: SsoHashMap<ty::TyVid, usize>,
304304
canonicalize_mode: &'cx dyn CanonicalizeMode,
305305
needs_canonical_flags: TypeFlags,
306-
307-
binder_index: ty::DebruijnIndex,
308306
}
309307

310308
impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
311309
fn cx(&self) -> TyCtxt<'tcx> {
312310
self.tcx
313311
}
314312

315-
fn fold_binder<T>(&mut self, t: ty::Binder<'tcx, T>) -> ty::Binder<'tcx, T>
316-
where
317-
T: TypeFoldable<TyCtxt<'tcx>>,
318-
{
319-
self.binder_index.shift_in(1);
320-
let t = t.super_fold_with(self);
321-
self.binder_index.shift_out(1);
322-
t
323-
}
324-
325313
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
326314
match r.kind() {
327-
ty::ReBound(ty::BoundVarIndexKind::Bound(index), ..) => {
328-
if index >= self.binder_index {
329-
bug!("escaping late-bound region during canonicalization");
330-
} else {
331-
r
332-
}
333-
}
315+
ty::ReBound(ty::BoundVarIndexKind::Bound(_), ..) => r,
334316

335317
ty::ReBound(ty::BoundVarIndexKind::Canonical, _) => {
336318
bug!("canonicalized bound var found during canonicalization");
@@ -407,13 +389,7 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
407389
self.canonicalize_ty_var(CanonicalVarKind::PlaceholderTy(placeholder), t)
408390
}
409391

410-
ty::Bound(ty::BoundVarIndexKind::Bound(debruijn), _) => {
411-
if debruijn >= self.binder_index {
412-
bug!("escaping bound type during canonicalization")
413-
} else {
414-
t
415-
}
416-
}
392+
ty::Bound(ty::BoundVarIndexKind::Bound(_), _) => t,
417393

418394
ty::Bound(ty::BoundVarIndexKind::Canonical, _) => {
419395
bug!("canonicalized bound var found during canonicalization");
@@ -487,12 +463,8 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
487463
ty::ConstKind::Infer(InferConst::Fresh(_)) => {
488464
bug!("encountered a fresh const during canonicalization")
489465
}
490-
ty::ConstKind::Bound(ty::BoundVarIndexKind::Bound(debruijn), _) => {
491-
if debruijn >= self.binder_index {
492-
bug!("escaping bound const during canonicalization")
493-
} else {
494-
return ct;
495-
}
466+
ty::ConstKind::Bound(ty::BoundVarIndexKind::Bound(_), _) => {
467+
return ct;
496468
}
497469
ty::ConstKind::Bound(ty::BoundVarIndexKind::Canonical, _) => {
498470
bug!("canonicalized bound var found during canonicalization");
@@ -580,7 +552,6 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
580552
query_state,
581553
indices: FxHashMap::default(),
582554
sub_root_lookup_table: Default::default(),
583-
binder_index: ty::INNERMOST,
584555
};
585556
if canonicalizer.query_state.var_values.spilled() {
586557
canonicalizer.indices = canonicalizer

compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
1414
use rustc_hir::{self as hir, CoroutineDesugaring, CoroutineKind};
1515
use rustc_infer::traits::{Obligation, PolyTraitObligation, SelectionError};
1616
use rustc_middle::ty::fast_reject::DeepRejectCtxt;
17-
use rustc_middle::ty::{
18-
self, SizedTraitKind, Ty, TypeFlags, TypeVisitableExt, TypingMode, elaborate,
19-
};
17+
use rustc_middle::ty::{self, SizedTraitKind, Ty, TypeVisitableExt, TypingMode, elaborate};
2018
use rustc_middle::{bug, span_bug};
2119
use tracing::{debug, instrument, trace};
2220

@@ -262,11 +260,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
262260
candidates: &mut SelectionCandidateSet<'tcx>,
263261
) -> Result<(), SelectionError<'tcx>> {
264262
debug!(?stack.obligation);
265-
if stack.obligation.param_env.has_type_flags(TypeFlags::HAS_CANONICAL_BOUND) {
266-
for b in stack.obligation.param_env.caller_bounds() {
267-
assert!(!b.has_type_flags(TypeFlags::HAS_CANONICAL_BOUND), "{:?} as bound vars", b);
268-
}
269-
}
270263

271264
let bounds = stack
272265
.obligation

0 commit comments

Comments
 (0)