File tree 1 file changed +6
-18
lines changed
compiler/rustc_trait_selection/src/traits
1 file changed +6
-18
lines changed Original file line number Diff line number Diff line change @@ -933,25 +933,13 @@ pub fn vtable_trait_upcasting_coercion_new_vptr_slot<'tcx>(
933
933
def_id : unsize_trait_did,
934
934
substs : tcx. mk_substs_trait ( source, & [ target. into ( ) ] ) ,
935
935
} ;
936
- let obligation = Obligation :: new (
937
- ObligationCause :: dummy ( ) ,
938
- ty:: ParamEnv :: reveal_all ( ) ,
939
- ty:: Binder :: dummy ( ty:: TraitPredicate {
940
- trait_ref,
941
- constness : ty:: BoundConstness :: NotConst ,
942
- polarity : ty:: ImplPolarity :: Positive ,
943
- } ) ,
944
- ) ;
945
-
946
- let infcx = tcx. infer_ctxt ( ) . build ( ) ;
947
- let mut selcx = SelectionContext :: new ( & infcx) ;
948
- let implsrc = selcx. select ( & obligation) . unwrap ( ) ;
949
936
950
- let Some ( ImplSource :: TraitUpcasting ( implsrc_traitcasting) ) = implsrc else {
951
- bug ! ( ) ;
952
- } ;
953
-
954
- implsrc_traitcasting. vtable_vptr_slot
937
+ match tcx. codegen_select_candidate ( ( ty:: ParamEnv :: reveal_all ( ) , ty:: Binder :: dummy ( trait_ref) ) ) {
938
+ Ok ( ImplSource :: TraitUpcasting ( implsrc_traitcasting) ) => {
939
+ implsrc_traitcasting. vtable_vptr_slot
940
+ }
941
+ otherwise => bug ! ( "expected TraitUpcasting candidate, got {otherwise:?}" ) ,
942
+ }
955
943
}
956
944
957
945
pub fn provide ( providers : & mut ty:: query:: Providers ) {
You can’t perform that action at this time.
0 commit comments