Skip to content

Commit f14ce9d

Browse files
Make diverging_type_vars a set of TyVid
1 parent 0469a92 commit f14ce9d

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

compiler/rustc_hir_typeck/src/fallback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
212212
.diverging_type_vars
213213
.borrow()
214214
.items()
215-
.map(|&ty| self.shallow_resolve(ty))
215+
.map(|&ty_id| self.shallow_resolve(Ty::new_var(self.tcx, ty_id)))
216216
.filter_map(|ty| ty.ty_vid())
217217
.map(|vid| self.root_var(vid))
218218
.collect();

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
321321
for a in &adj {
322322
match a.kind {
323323
Adjust::NeverToAny => {
324-
if a.target.is_ty_var() {
325-
self.diverging_type_vars.borrow_mut().insert(a.target);
324+
if let ty::Infer(ty::TyVar(a_id)) = a.target.kind() {
325+
self.diverging_type_vars.borrow_mut().insert(*a_id);
326326
debug!("apply_adjustments: adding `{:?}` as diverging type var", a.target);
327327
}
328328
}

compiler/rustc_hir_typeck/src/typeck_root_ctxt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_hir::def_id::LocalDefId;
66
use rustc_hir::{self as hir, HirId, HirIdMap};
77
use rustc_infer::infer::{InferCtxt, InferOk, OpaqueTypeStorageEntries, TyCtxtInferExt};
88
use rustc_middle::span_bug;
9-
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt, TypingMode};
9+
use rustc_middle::ty::{self, Ty, TyCtxt, TyVid, TypeVisitableExt, TypingMode};
1010
use rustc_span::Span;
1111
use rustc_span::def_id::LocalDefIdMap;
1212
use rustc_trait_selection::traits::{self, FulfillmentError, TraitEngine, TraitEngineExt as _};
@@ -66,7 +66,7 @@ pub(crate) struct TypeckRootCtxt<'tcx> {
6666
/// Whenever we introduce an adjustment from `!` into a type variable,
6767
/// we record that type variable here. This is later used to inform
6868
/// fallback. See the `fallback` module for details.
69-
pub(super) diverging_type_vars: RefCell<UnordSet<Ty<'tcx>>>,
69+
pub(super) diverging_type_vars: RefCell<UnordSet<TyVid>>,
7070
}
7171

7272
impl<'tcx> Deref for TypeckRootCtxt<'tcx> {

0 commit comments

Comments
 (0)