@@ -573,7 +573,9 @@ pub fn type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>, usage_site_span: Sp
573573
574574 let ptr_metadata = |ty : Ty < ' tcx > | match ty. kind {
575575 ty:: Slice ( typ) => Ok ( vec_slice_metadata ( cx, t, typ, unique_type_id, usage_site_span) ) ,
576- ty:: Str => Ok ( vec_slice_metadata ( cx, t, cx. tcx . types . u8 , unique_type_id, usage_site_span) ) ,
576+ ty:: Adt ( def, _) if def. is_str ( ) => {
577+ Ok ( vec_slice_metadata ( cx, t, cx. tcx . types . u8 , unique_type_id, usage_site_span) )
578+ }
577579 ty:: Dynamic ( ..) => Ok ( MetadataCreationResult :: new (
578580 trait_pointer_metadata ( cx, ty, Some ( t) , unique_type_id) ,
579581 false ,
@@ -601,7 +603,9 @@ pub fn type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>, usage_site_span: Sp
601603 ty:: Array ( typ, _) | ty:: Slice ( typ) => {
602604 fixed_vec_metadata ( cx, unique_type_id, t, typ, usage_site_span)
603605 }
604- ty:: Str => fixed_vec_metadata ( cx, unique_type_id, t, cx. tcx . types . i8 , usage_site_span) ,
606+ ty:: Adt ( def, _) if def. is_str ( ) => {
607+ fixed_vec_metadata ( cx, unique_type_id, t, cx. tcx . types . i8 , usage_site_span)
608+ }
605609 ty:: Dynamic ( ..) => {
606610 MetadataCreationResult :: new ( trait_pointer_metadata ( cx, t, None , unique_type_id) , false )
607611 }
0 commit comments