@@ -5,7 +5,7 @@ mod opaque_types;
5
5
6
6
use rustc_type_ir:: fast_reject:: DeepRejectCtxt ;
7
7
use rustc_type_ir:: inherent:: * ;
8
- use rustc_type_ir:: lang_items:: { SolverLangItem , SolverTraitLangItem } ;
8
+ use rustc_type_ir:: lang_items:: { SolverAdtLangItem , SolverLangItem , SolverTraitLangItem } ;
9
9
use rustc_type_ir:: solve:: SizedTraitKind ;
10
10
use rustc_type_ir:: { self as ty, Interner , NormalizesTo , PredicateKind , Upcast as _} ;
11
11
use tracing:: instrument;
@@ -193,7 +193,7 @@ where
193
193
fn consider_impl_candidate (
194
194
ecx : & mut EvalCtxt < ' _ , D > ,
195
195
goal : Goal < I , NormalizesTo < I > > ,
196
- impl_def_id : I :: DefId ,
196
+ impl_def_id : I :: ImplId ,
197
197
) -> Result < Candidate < I > , NoSolution > {
198
198
let cx = ecx. cx ( ) ;
199
199
@@ -217,13 +217,13 @@ where
217
217
} ;
218
218
219
219
ecx. probe_trait_candidate ( CandidateSource :: Impl ( impl_def_id) ) . enter ( |ecx| {
220
- let impl_args = ecx. fresh_args_for_item ( impl_def_id) ;
220
+ let impl_args = ecx. fresh_args_for_item ( impl_def_id. into ( ) ) ;
221
221
let impl_trait_ref = impl_trait_ref. instantiate ( cx, impl_args) ;
222
222
223
223
ecx. eq ( goal. param_env , goal_trait_ref, impl_trait_ref) ?;
224
224
225
225
let where_clause_bounds = cx
226
- . predicates_of ( impl_def_id)
226
+ . predicates_of ( impl_def_id. into ( ) )
227
227
. iter_instantiated ( cx, impl_args)
228
228
. map ( |pred| goal. with ( cx, pred) ) ;
229
229
ecx. add_goals ( GoalSource :: ImplWhereBound , where_clause_bounds) ;
@@ -824,10 +824,10 @@ where
824
824
// coroutine yield ty `Poll<Option<I>>`.
825
825
let wrapped_expected_ty = Ty :: new_adt (
826
826
cx,
827
- cx. adt_def ( cx. require_lang_item ( SolverLangItem :: Poll ) ) ,
827
+ cx. adt_def ( cx. require_adt_lang_item ( SolverAdtLangItem :: Poll ) ) ,
828
828
cx. mk_args ( & [ Ty :: new_adt (
829
829
cx,
830
- cx. adt_def ( cx. require_lang_item ( SolverLangItem :: Option ) ) ,
830
+ cx. adt_def ( cx. require_adt_lang_item ( SolverAdtLangItem :: Option ) ) ,
831
831
cx. mk_args ( & [ expected_ty. into ( ) ] ) ,
832
832
)
833
833
. into ( ) ] ) ,
@@ -979,7 +979,7 @@ where
979
979
fn translate_args (
980
980
& mut self ,
981
981
goal : Goal < I , ty:: NormalizesTo < I > > ,
982
- impl_def_id : I :: DefId ,
982
+ impl_def_id : I :: ImplId ,
983
983
impl_args : I :: GenericArgs ,
984
984
impl_trait_ref : rustc_type_ir:: TraitRef < I > ,
985
985
target_container_def_id : I :: DefId ,
@@ -988,14 +988,15 @@ where
988
988
Ok ( if target_container_def_id == impl_trait_ref. def_id . into ( ) {
989
989
// Default value from the trait definition. No need to rebase.
990
990
goal. predicate . alias . args
991
- } else if target_container_def_id == impl_def_id {
991
+ } else if target_container_def_id == impl_def_id. into ( ) {
992
992
// Same impl, no need to fully translate, just a rebase from
993
993
// the trait is sufficient.
994
994
goal. predicate . alias . args . rebase_onto ( cx, impl_trait_ref. def_id . into ( ) , impl_args)
995
995
} else {
996
996
let target_args = self . fresh_args_for_item ( target_container_def_id) ;
997
- let target_trait_ref =
998
- cx. impl_trait_ref ( target_container_def_id) . instantiate ( cx, target_args) ;
997
+ let target_trait_ref = cx
998
+ . impl_trait_ref ( target_container_def_id. try_into ( ) . unwrap ( ) )
999
+ . instantiate ( cx, target_args) ;
999
1000
// Relate source impl to target impl by equating trait refs.
1000
1001
self . eq ( goal. param_env , impl_trait_ref, target_trait_ref) ?;
1001
1002
// Also add predicates since they may be needed to constrain the
0 commit comments