Skip to content

Commit c17d24e

Browse files
Make diverging_type_vars a Vec
It being a `Set` does not really make sense. You never really should do a `contains` on it, since you should normalize the tyvid to its root var first.
1 parent f14ce9d commit c17d24e

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

compiler/rustc_hir_typeck/src/fallback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
211211
let diverging_roots: UnordSet<ty::TyVid> = self
212212
.diverging_type_vars
213213
.borrow()
214-
.items()
214+
.iter()
215215
.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))

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
322322
match a.kind {
323323
Adjust::NeverToAny => {
324324
if let ty::Infer(ty::TyVar(a_id)) = a.target.kind() {
325-
self.diverging_type_vars.borrow_mut().insert(*a_id);
325+
self.diverging_type_vars.borrow_mut().push(*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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::cell::{Cell, RefCell};
22
use std::ops::Deref;
33

4-
use rustc_data_structures::unord::UnordSet;
54
use rustc_hir::def_id::LocalDefId;
65
use rustc_hir::{self as hir, HirId, HirIdMap};
76
use rustc_infer::infer::{InferCtxt, InferOk, OpaqueTypeStorageEntries, TyCtxtInferExt};
@@ -66,7 +65,7 @@ pub(crate) struct TypeckRootCtxt<'tcx> {
6665
/// Whenever we introduce an adjustment from `!` into a type variable,
6766
/// we record that type variable here. This is later used to inform
6867
/// fallback. See the `fallback` module for details.
69-
pub(super) diverging_type_vars: RefCell<UnordSet<TyVid>>,
68+
pub(super) diverging_type_vars: RefCell<Vec<TyVid>>,
7069
}
7170

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

0 commit comments

Comments
 (0)