File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -48,19 +48,12 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
4848) -> ( Pointer , Value ) {
4949 let ( ptr, vtable) = ' block: {
5050 if let Abi :: Scalar ( _) = arg. layout ( ) . abi {
51- ' descend_newtypes: while !arg. layout ( ) . ty . is_unsafe_ptr ( ) && !arg. layout ( ) . ty . is_ref ( ) {
52- for i in 0 ..arg. layout ( ) . fields . count ( ) {
53- let field = arg. value_field ( fx, FieldIdx :: new ( i) ) ;
54- if !field. layout ( ) . is_1zst ( ) {
55- // we found the one non-1-ZST field that is allowed
56- // now find *its* non-zero-sized field, or stop if it's a
57- // pointer
58- arg = field;
59- continue ' descend_newtypes;
60- }
61- }
62-
63- bug ! ( "receiver has no non-zero-sized fields {:?}" , arg) ;
51+ while !arg. layout ( ) . ty . is_unsafe_ptr ( ) && !arg. layout ( ) . ty . is_ref ( ) {
52+ let ( idx, _) = arg
53+ . layout ( )
54+ . non_1zst_field ( fx)
55+ . expect ( "not exactly one non-1-ZST field in a `DispatchFromDyn` type" ) ;
56+ arg = arg. value_field ( fx, FieldIdx :: new ( idx) ) ;
6457 }
6558 }
6659
You can’t perform that action at this time.
0 commit comments