File tree 1 file changed +6
-13
lines changed
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>(
48
48
) -> ( Pointer , Value ) {
49
49
let ( ptr, vtable) = ' block: {
50
50
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) ) ;
64
57
}
65
58
}
66
59
You can’t perform that action at this time.
0 commit comments