Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 42fc2f9

Browse files
committedNov 24, 2023
Get rid of infer vars in inherent assoc types selection by using EagerResolver folder
1 parent 2e7bb95 commit 42fc2f9

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed
 

‎compiler/rustc_hir_analysis/src/astconv/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ use rustc_middle::middle::stability::AllowUnstable;
3232
use rustc_middle::ty::GenericParamDefKind;
3333
use rustc_middle::ty::{
3434
self, Const, GenericArgKind, GenericArgsRef, IsSuggestable, ParamEnv, Predicate, Ty, TyCtxt,
35-
TypeVisitableExt,
35+
TypeFoldable, TypeVisitableExt,
3636
};
3737
use rustc_session::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS;
3838
use rustc_span::edit_distance::find_best_match_for_name;
3939
use rustc_span::symbol::{kw, Ident, Symbol};
4040
use rustc_span::{sym, BytePos, Span, DUMMY_SP};
4141
use rustc_target::spec::abi;
42+
use rustc_trait_selection::solve::eval_ctxt::canonical::EagerResolver;
4243
use rustc_trait_selection::traits::wf::object_region_bounds;
4344
use rustc_trait_selection::traits::{self, NormalizeExt, ObligationCtxt};
4445

@@ -1648,6 +1649,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
16481649
);
16491650

16501651
let ty = Ty::new_alias(tcx, ty::Inherent, ty::AliasTy::new(tcx, assoc_item, args));
1652+
let ty = ty.fold_with(&mut EagerResolver { infcx });
16511653

16521654
Ok(Some((ty, assoc_item)))
16531655
},

‎compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,8 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
365365
}
366366

367367
/// Resolves ty, region, and const vars to their inferred values or their root vars.
368-
struct EagerResolver<'a, 'tcx> {
369-
infcx: &'a InferCtxt<'tcx>,
368+
pub struct EagerResolver<'a, 'tcx> {
369+
pub infcx: &'a InferCtxt<'tcx>,
370370
}
371371

372372
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for EagerResolver<'_, 'tcx> {

‎compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use super::{search_graph, GoalEvaluationKind};
3333
use super::{search_graph::SearchGraph, Goal};
3434
pub use select::InferCtxtSelectExt;
3535

36-
mod canonical;
36+
pub mod canonical;
3737
mod commit_if_ok;
3838
mod probe;
3939
mod select;

‎compiler/rustc_trait_selection/src/solve/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use rustc_middle::ty::{
3131
mod alias_relate;
3232
mod assembly;
3333
mod canonicalize;
34-
mod eval_ctxt;
34+
pub mod eval_ctxt;
3535
mod fulfill;
3636
pub mod inspect;
3737
mod normalize;

0 commit comments

Comments
 (0)
Please sign in to comment.