1
- use rustc_hir:: def_id:: DefId ;
1
+ use rustc_hir:: def_id:: { DefId , LocalDefId } ;
2
2
use rustc_infer:: infer:: at:: ToTrace ;
3
3
use rustc_infer:: infer:: canonical:: CanonicalVarValues ;
4
4
use rustc_infer:: infer:: type_variable:: { TypeVariableOrigin , TypeVariableOriginKind } ;
@@ -192,13 +192,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
192
192
193
193
for & ( a, b) in & input. predefined_opaques_in_body . opaque_types {
194
194
let InferOk { value : ( ) , obligations } = infcx
195
- . handle_opaque_type (
196
- tcx. mk_opaque ( a. def_id . to_def_id ( ) , a. substs ) ,
197
- b,
198
- true ,
199
- & ObligationCause :: dummy ( ) ,
200
- input. goal . param_env ,
201
- )
195
+ . register_hidden_type_in_new_solver ( a, input. goal . param_env , b)
202
196
. expect ( "expected opaque type instantiation to succeed" ) ;
203
197
// We're only registering opaques already defined by the caller,
204
198
// so we're not responsible for proving that they satisfy their
@@ -727,19 +721,18 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
727
721
}
728
722
}
729
723
730
- pub ( super ) fn can_define_opaque_ty ( & mut self , def_id : DefId ) -> bool {
731
- let Some ( def_id) = def_id. as_local ( ) else { return false ; } ;
724
+ pub ( super ) fn can_define_opaque_ty ( & mut self , def_id : LocalDefId ) -> bool {
732
725
self . infcx . opaque_type_origin ( def_id) . is_some ( )
733
726
}
734
727
735
728
pub ( super ) fn register_opaque_ty (
736
729
& mut self ,
737
- a : Ty < ' tcx > ,
730
+ a : ty :: OpaqueTypeKey < ' tcx > ,
738
731
b : Ty < ' tcx > ,
739
732
param_env : ty:: ParamEnv < ' tcx > ,
740
733
) -> Result < ( ) , NoSolution > {
741
734
let InferOk { value : ( ) , obligations } =
742
- self . infcx . handle_opaque_type ( a, b , true , & ObligationCause :: dummy ( ) , param_env ) ?;
735
+ self . infcx . register_hidden_type_in_new_solver ( a, param_env , b ) ?;
743
736
self . add_goals ( obligations. into_iter ( ) . map ( |obligation| obligation. into ( ) ) ) ;
744
737
Ok ( ( ) )
745
738
}
@@ -749,17 +742,15 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
749
742
pub ( super ) fn unify_existing_opaque_tys (
750
743
& mut self ,
751
744
param_env : ty:: ParamEnv < ' tcx > ,
752
- key : ty:: AliasTy < ' tcx > ,
745
+ key : ty:: OpaqueTypeKey < ' tcx > ,
753
746
ty : Ty < ' tcx > ,
754
747
) -> Vec < CanonicalResponse < ' tcx > > {
755
- let Some ( def_id) = key. def_id . as_local ( ) else { return vec ! [ ] ; } ;
756
-
757
748
// FIXME: Super inefficient to be cloning this...
758
749
let opaques = self . infcx . clone_opaque_types_for_query_response ( ) ;
759
750
760
751
let mut values = vec ! [ ] ;
761
752
for ( candidate_key, candidate_ty) in opaques {
762
- if candidate_key. def_id != def_id {
753
+ if candidate_key. def_id != key . def_id {
763
754
continue ;
764
755
}
765
756
values. extend ( self . probe ( |ecx| {
0 commit comments