Skip to content

Commit

Permalink
Get rid of infer vars in inherent assoc types selection by using Eage…
Browse files Browse the repository at this point in the history
…rResolver folder
  • Loading branch information
spastorino committed Nov 24, 2023
1 parent 2e7bb95 commit 42fc2f9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion compiler/rustc_hir_analysis/src/astconv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ use rustc_middle::middle::stability::AllowUnstable;
use rustc_middle::ty::GenericParamDefKind;
use rustc_middle::ty::{
self, Const, GenericArgKind, GenericArgsRef, IsSuggestable, ParamEnv, Predicate, Ty, TyCtxt,
TypeVisitableExt,
TypeFoldable, TypeVisitableExt,
};
use rustc_session::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS;
use rustc_span::edit_distance::find_best_match_for_name;
use rustc_span::symbol::{kw, Ident, Symbol};
use rustc_span::{sym, BytePos, Span, DUMMY_SP};
use rustc_target::spec::abi;
use rustc_trait_selection::solve::eval_ctxt::canonical::EagerResolver;
use rustc_trait_selection::traits::wf::object_region_bounds;
use rustc_trait_selection::traits::{self, NormalizeExt, ObligationCtxt};

Expand Down Expand Up @@ -1648,6 +1649,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
);

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

Ok(Some((ty, assoc_item)))
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
}

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

impl<'tcx> TypeFolder<TyCtxt<'tcx>> for EagerResolver<'_, 'tcx> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use super::{search_graph, GoalEvaluationKind};
use super::{search_graph::SearchGraph, Goal};
pub use select::InferCtxtSelectExt;

mod canonical;
pub mod canonical;
mod commit_if_ok;
mod probe;
mod select;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/solve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use rustc_middle::ty::{
mod alias_relate;
mod assembly;
mod canonicalize;
mod eval_ctxt;
pub mod eval_ctxt;
mod fulfill;
pub mod inspect;
mod normalize;
Expand Down

0 comments on commit 42fc2f9

Please sign in to comment.