Skip to content

Commit 53ceea8

Browse files
Rename probe_ty_var to try_resolve_ty_var
Co-authored-by: khyperia <953151+khyperia@users.noreply.github.com>
1 parent ddd36bd commit 53ceea8

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
341341
}
342342

343343
debug!("canonical: type var found with vid {:?}", vid);
344-
match self.infcx.unwrap().probe_ty_var(vid) {
344+
match self.infcx.unwrap().try_resolve_ty_var(vid) {
345345
// `t` could be a float / int variable; canonicalize that instead.
346346
Ok(t) => {
347347
debug!("(resolved to {:?})", t);

compiler/rustc_infer/src/infer/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl<'tcx> rustc_type_ir::InferCtxtLike for InferCtxt<'tcx> {
3535
}
3636

3737
fn universe_of_ty(&self, vid: ty::TyVid) -> Option<ty::UniverseIndex> {
38-
match self.probe_ty_var(vid) {
38+
match self.try_resolve_ty_var(vid) {
3939
Err(universe) => Some(universe),
4040
Ok(_) => None,
4141
}
@@ -68,7 +68,7 @@ impl<'tcx> rustc_type_ir::InferCtxtLike for InferCtxt<'tcx> {
6868
}
6969

7070
fn opportunistic_resolve_ty_var(&self, vid: ty::TyVid) -> Ty<'tcx> {
71-
match self.probe_ty_var(vid) {
71+
match self.try_resolve_ty_var(vid) {
7272
Ok(ty) => ty,
7373
Err(_) => Ty::new_var(self.tcx, self.root_var(vid)),
7474
}
@@ -103,7 +103,7 @@ impl<'tcx> rustc_type_ir::InferCtxtLike for InferCtxt<'tcx> {
103103
if let ty::Infer(infer_ty) = *ty.kind() {
104104
match infer_ty {
105105
ty::InferTy::TyVar(vid) => {
106-
!self.probe_ty_var(vid).is_err_and(|_| self.root_var(vid) == vid)
106+
!self.try_resolve_ty_var(vid).is_err_and(|_| self.root_var(vid) == vid)
107107
}
108108
ty::InferTy::IntVar(vid) => {
109109
let mut inner = self.inner.borrow_mut();

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ impl<'tcx> InferCtxt<'tcx> {
10741074

10751075
/// If `TyVar(vid)` resolves to a type, return that type. Else, return the
10761076
/// universe index of `TyVar(vid)`.
1077-
pub fn probe_ty_var(&self, vid: TyVid) -> Result<Ty<'tcx>, ty::UniverseIndex> {
1077+
pub fn try_resolve_ty_var(&self, vid: TyVid) -> Result<Ty<'tcx>, ty::UniverseIndex> {
10781078
use self::type_variable::TypeVariableValue;
10791079

10801080
match self.inner.borrow_mut().type_variables().probe(vid) {

compiler/rustc_infer/src/infer/relate/generalize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl<'tcx> InferCtxt<'tcx> {
253253
assert!(!source_term.has_escaping_bound_vars());
254254
let (for_universe, root_vid) = match target_vid.into() {
255255
TermVid::Ty(ty_vid) => {
256-
(self.probe_ty_var(ty_vid).unwrap_err(), TermVid::Ty(self.root_var(ty_vid)))
256+
(self.try_resolve_ty_var(ty_vid).unwrap_err(), TermVid::Ty(self.root_var(ty_vid)))
257257
}
258258
TermVid::Const(ct_vid) => (
259259
self.probe_const_var(ct_vid).unwrap_err(),

compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for ClosureEraser<'a, 'tcx> {
247247
fn fmt_printer<'a, 'tcx>(infcx: &'a InferCtxt<'tcx>, ns: Namespace) -> FmtPrinter<'a, 'tcx> {
248248
let mut p = FmtPrinter::new(infcx.tcx, ns);
249249
let ty_getter = move |ty_vid| {
250-
if infcx.probe_ty_var(ty_vid).is_ok() {
250+
if infcx.try_resolve_ty_var(ty_vid).is_ok() {
251251
warn!("resolved ty var in error message");
252252
}
253253

0 commit comments

Comments
 (0)