Remove redundant shallow_resolve call

This commit is contained in:
Shoyu Vanilla 2026-02-11 17:50:50 +09:00
parent 13a83cb639
commit 955f7750c1
2 changed files with 7 additions and 5 deletions

View file

@ -357,11 +357,6 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
VecGraph::new(num_ty_vars, coercion_edges)
}
/// If `ty` is an unresolved type variable, returns its root vid.
fn root_vid(&self, ty: Ty<'tcx>) -> Option<ty::TyVid> {
Some(self.root_var(self.shallow_resolve(ty).ty_vid()?))
}
/// Given a set of diverging vids and coercions, walk the HIR to gather a
/// set of suggestions which can be applied to preserve fallback to unit.
fn try_to_suggest_annotations(

View file

@ -1184,6 +1184,13 @@ impl<'tcx> InferCtxt<'tcx> {
self.inner.borrow_mut().type_variables().root_var(var)
}
/// If `ty` is an unresolved type variable, returns its root vid.
pub fn root_vid(&self, ty: Ty<'tcx>) -> Option<ty::TyVid> {
let (root, value) =
self.inner.borrow_mut().type_variables().inlined_probe_with_vid(ty.ty_vid()?);
value.is_unknown().then_some(root)
}
pub fn sub_unify_ty_vids_raw(&self, a: ty::TyVid, b: ty::TyVid) {
self.inner.borrow_mut().type_variables().sub_unify(a, b);
}