@@ -948,52 +948,24 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
948948 let tail_field_ty = tcx. type_of ( tail_field. did ) ;
949949
950950 let mut unsizing_params = GrowableBitSet :: new_empty ( ) ;
951- if tcx. features ( ) . relaxed_struct_unsize {
952- for arg in tail_field_ty. walk ( tcx) {
953- if let Some ( i) = maybe_unsizing_param_idx ( arg) {
954- unsizing_params. insert ( i) ;
955- }
956- }
957-
958- // Ensure none of the other fields mention the parameters used
959- // in unsizing.
960- for field in prefix_fields {
961- for arg in tcx. type_of ( field. did ) . walk ( tcx) {
962- if let Some ( i) = maybe_unsizing_param_idx ( arg) {
963- unsizing_params. remove ( i) ;
964- }
965- }
951+ for arg in tail_field_ty. walk ( tcx) {
952+ if let Some ( i) = maybe_unsizing_param_idx ( arg) {
953+ unsizing_params. insert ( i) ;
966954 }
955+ }
967956
968- if unsizing_params. is_empty ( ) {
969- return Err ( Unimplemented ) ;
970- }
971- } else {
972- let mut found = false ;
973- for arg in tail_field_ty. walk ( tcx) {
957+ // Ensure none of the other fields mention the parameters used
958+ // in unsizing.
959+ for field in prefix_fields {
960+ for arg in tcx. type_of ( field. did ) . walk ( tcx) {
974961 if let Some ( i) = maybe_unsizing_param_idx ( arg) {
975- unsizing_params. insert ( i) ;
976- found = true ;
962+ unsizing_params. remove ( i) ;
977963 }
978964 }
979- if !found {
980- return Err ( Unimplemented ) ;
981- }
965+ }
982966
983- // Ensure none of the other fields mention the parameters used
984- // in unsizing.
985- // FIXME(eddyb) cache this (including computing `unsizing_params`)
986- // by putting it in a query; it would only need the `DefId` as it
987- // looks at declared field types, not anything substituted.
988- for field in prefix_fields {
989- for arg in tcx. type_of ( field. did ) . walk ( tcx) {
990- if let Some ( i) = maybe_unsizing_param_idx ( arg) {
991- if unsizing_params. contains ( i) {
992- return Err ( Unimplemented ) ;
993- }
994- }
995- }
996- }
967+ if unsizing_params. is_empty ( ) {
968+ return Err ( Unimplemented ) ;
997969 }
998970
999971 // Extract `TailField<T>` and `TailField<U>` from `Struct<T>` and `Struct<U>`.
0 commit comments