@@ -77,7 +77,7 @@ impl VTableMap {
7777 id
7878 }
7979
80- fn ty ( & self , id : usize ) -> Result < & Ty > {
80+ pub ( crate ) fn ty ( & self , id : usize ) -> Result < & Ty > {
8181 self . id_to_ty . get ( id) . ok_or ( MirEvalError :: InvalidVTableId ( id) )
8282 }
8383
@@ -1571,24 +1571,32 @@ impl Evaluator<'_> {
15711571 }
15721572 None => {
15731573 let mut check_inner = None ;
1574+ let ( addr, meta) = bytes. split_at ( bytes. len ( ) / 2 ) ;
15741575 let element_size = match t. kind ( Interner ) {
15751576 TyKind :: Str => 1 ,
15761577 TyKind :: Slice ( t) => {
15771578 check_inner = Some ( t) ;
15781579 this. size_of_sized ( t, locals, "slice inner type" ) ?
15791580 }
1580- _ => return Ok ( ( ) ) , // FIXME: support other kind of unsized types
1581+ TyKind :: Dyn ( _) => {
1582+ let t = this. vtable_map . ty_of_bytes ( meta) ?;
1583+ check_inner = Some ( t) ;
1584+ this. size_of_sized ( t, locals, "dyn concrete type" ) ?
1585+ }
1586+ _ => return Ok ( ( ) ) ,
1587+ } ;
1588+ let count = match t. kind ( Interner ) {
1589+ TyKind :: Dyn ( _) => 1 ,
1590+ _ => from_bytes ! ( usize , meta) ,
15811591 } ;
1582- let ( addr, meta) = bytes. split_at ( bytes. len ( ) / 2 ) ;
1583- let count = from_bytes ! ( usize , meta) ;
15841592 let size = element_size * count;
15851593 let addr = Address :: from_bytes ( addr) ?;
15861594 let b = this. read_memory ( addr, size) ?;
15871595 mm. insert ( addr. to_usize ( ) , b. to_vec ( ) ) ;
15881596 if let Some ( ty) = check_inner {
15891597 for i in 0 ..count {
15901598 let offset = element_size * i;
1591- rec ( this, & b[ offset..offset + element_size] , ty, locals, mm) ?;
1599+ rec ( this, & b[ offset..offset + element_size] , & ty, locals, mm) ?;
15921600 }
15931601 }
15941602 }
0 commit comments