@@ -204,13 +204,8 @@ impl<'tcx> CValue<'tcx> {
204204 let ( field_ptr, field_layout) = codegen_field ( fx, ptr, None , layout, field) ;
205205 CValue :: by_ref ( field_ptr, field_layout)
206206 }
207- CValueInner :: ByRef ( ptr, Some ( extra) ) => {
208- let ( field_ptr, field_layout) = codegen_field ( fx, ptr, Some ( extra) , layout, field) ;
209- if fx. tcx . type_has_metadata ( field_layout. ty , ty:: TypingEnv :: fully_monomorphized ( ) ) {
210- CValue :: by_ref_unsized ( field_ptr, extra, field_layout)
211- } else {
212- CValue :: by_ref ( field_ptr, field_layout)
213- }
207+ CValueInner :: ByRef ( _, Some ( _) ) => {
208+ bug ! ( "value_field for unsized by-ref value not supported" )
214209 }
215210 }
216211 }
@@ -662,24 +657,11 @@ impl<'tcx> CPlace<'tcx> {
662657 flags,
663658 ) ;
664659 }
665- CValueInner :: ByRef ( from_ptr, Some ( _extra) ) => {
666- // Unsized values shouldn't normally be written into sized places. However,
667- // if this happens, we can still copy the sized prefix using the destination layout's fixed size.
668- let from_addr = from_ptr. get_addr ( fx) ;
669- let to_addr = to_ptr. get_addr ( fx) ;
670- let src_layout = from. 1 ;
671- let size = dst_layout. size . bytes ( ) ;
672- let src_align = src_layout. align . bytes ( ) . try_into ( ) . unwrap_or ( 128 ) ;
673- let dst_align = dst_layout. align . bytes ( ) . try_into ( ) . unwrap_or ( 128 ) ;
674- fx. bcx . emit_small_memory_copy (
675- fx. target_config ,
676- to_addr,
677- from_addr,
678- size,
679- dst_align,
680- src_align,
681- true ,
682- flags,
660+ CValueInner :: ByRef ( _from_ptr, Some ( _extra) ) => {
661+ bug ! (
662+ "write_cvalue for unsized by-ref value not allowed: dst={:?} src={:?}" ,
663+ dst_layout. ty,
664+ from. layout( ) . ty
683665 ) ;
684666 }
685667 }
0 commit comments