File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -492,6 +492,41 @@ pub fn miri_to_const(result: &ty::Const<'_>) -> Option<Constant> {
492
492
} ,
493
493
_ => None ,
494
494
} ,
495
+ ty:: ConstKind :: Value ( ConstValue :: ByRef { alloc, offset : _ } ) => match result. ty . kind {
496
+ ty:: Array ( sub_type, len) => match sub_type. kind {
497
+ ty:: Float ( FloatTy :: F32 ) => match miri_to_const ( len) {
498
+ Some ( Constant :: Int ( len) ) => alloc
499
+ . inspect_with_undef_and_ptr_outside_interpreter ( 0 ..( 4 * len as usize ) )
500
+ . to_owned ( )
501
+ . chunks ( 4 )
502
+ . map ( |chunk| {
503
+ Some ( Constant :: F32 ( f32:: from_le_bytes (
504
+ chunk. try_into ( ) . expect ( "this shouldn't happen" ) ,
505
+ ) ) )
506
+ } )
507
+ . collect :: < Option < Vec < Constant > > > ( )
508
+ . map ( Constant :: Vec ) ,
509
+ _ => None ,
510
+ } ,
511
+ ty:: Float ( FloatTy :: F64 ) => match miri_to_const ( len) {
512
+ Some ( Constant :: Int ( len) ) => alloc
513
+ . inspect_with_undef_and_ptr_outside_interpreter ( 0 ..( 8 * len as usize ) )
514
+ . to_owned ( )
515
+ . chunks ( 8 )
516
+ . map ( |chunk| {
517
+ Some ( Constant :: F64 ( f64:: from_le_bytes (
518
+ chunk. try_into ( ) . expect ( "this shouldn't happen" ) ,
519
+ ) ) )
520
+ } )
521
+ . collect :: < Option < Vec < Constant > > > ( )
522
+ . map ( Constant :: Vec ) ,
523
+ _ => None ,
524
+ } ,
525
+ // FIXME: implement other array type conversions.
526
+ _ => None ,
527
+ } ,
528
+ _ => None ,
529
+ } ,
495
530
// FIXME: implement other conversions.
496
531
_ => None ,
497
532
}
You can’t perform that action at this time.
0 commit comments