@@ -793,68 +793,68 @@ fn const_eval<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
793
793
} ;
794
794
795
795
let instance = ty:: Instance :: new ( def_id, substs) ;
796
- let miri_result = :: rustc:: interpret:: eval_body_as_primval ( tcx, instance) ;
796
+ let miri_result = :: rustc:: mir :: interpret:: eval_body_as_primval ( tcx, instance) ;
797
797
let old_result = ConstContext :: new ( tcx, key. param_env . and ( substs) , tables) . eval ( & body. value ) ;
798
798
match ( miri_result, old_result) {
799
799
( Err ( err) , Ok ( ok) ) => {
800
- warn ! ( "miri fails to eval {:?} to {:?} with error {:?}" , key, ok, err) ;
801
- Ok ( ok)
800
+ panic ! ( "miri fails to eval {:?} to {:?} with error {:?}" , key, ok, err) ;
801
+ // Ok(ok)
802
802
} ,
803
803
( Ok ( ok) , Err ( err) ) => {
804
- info ! ( "miri can eval {:?} to {:?}, while old ctfe fails with {:?}" , key, ok, err) ;
805
- Err ( err)
804
+ panic ! ( "miri can eval {:?} to {:?}, while old ctfe fails with {:?}" , key, ok, err) ;
805
+ // Err(err)
806
806
} ,
807
807
( Err ( _) , Err ( err) ) => Err ( err) ,
808
808
( Ok ( ( miri_val, miri_ty) ) , Ok ( ctfe) ) => {
809
809
use rustc:: ty:: TypeVariants :: * ;
810
- use rustc:: interpret:: PrimVal ;
810
+ use rustc:: mir :: interpret:: PrimVal ;
811
811
match ( miri_val, & miri_ty. sty , ctfe. val ) {
812
812
( PrimVal :: Undef , _, _) => {
813
- warn ! ( "miri produced an undef, while old ctfe produced {:?}" , ctfe) ;
813
+ panic ! ( "miri produced an undef, while old ctfe produced {:?}" , ctfe) ;
814
814
} ,
815
815
( PrimVal :: Ptr ( _) , _, _) => {
816
- warn ! ( "miri produced a pointer, which isn't implemented yet" ) ;
816
+ panic ! ( "miri produced a pointer, which isn't implemented yet" ) ;
817
817
} ,
818
818
( PrimVal :: Bytes ( b) , & TyInt ( int_ty) , ConstVal :: Integral ( ci) ) => {
819
819
let c = ConstInt :: new_signed_truncating ( b as i128 ,
820
820
int_ty,
821
821
tcx. sess . target . isize_ty ) ;
822
822
if c != ci {
823
- warn ! ( "miri evaluated to {}, but ctfe yielded {}" , b as i128 , ci) ;
823
+ panic ! ( "miri evaluated to {}, but ctfe yielded {}" , b as i128 , ci) ;
824
824
}
825
825
}
826
826
( PrimVal :: Bytes ( b) , & TyUint ( int_ty) , ConstVal :: Integral ( ci) ) => {
827
827
let c = ConstInt :: new_unsigned_truncating ( b, int_ty, tcx. sess . target . usize_ty ) ;
828
828
if c != ci {
829
- warn ! ( "miri evaluated to {}, but ctfe yielded {}" , b, ci) ;
829
+ panic ! ( "miri evaluated to {}, but ctfe yielded {}" , b, ci) ;
830
830
}
831
831
}
832
832
( PrimVal :: Bytes ( bits) , & TyFloat ( ty) , ConstVal :: Float ( cf) ) => {
833
833
let f = ConstFloat { bits, ty } ;
834
834
if f != cf {
835
- warn ! ( "miri evaluated to {}, but ctfe yielded {}" , f, cf) ;
835
+ panic ! ( "miri evaluated to {}, but ctfe yielded {}" , f, cf) ;
836
836
}
837
837
}
838
838
( PrimVal :: Bytes ( bits) , & TyBool , ConstVal :: Bool ( b) ) => {
839
839
if bits == 0 && b {
840
- warn ! ( "miri evaluated to {}, but ctfe yielded {}" , bits == 0 , b) ;
840
+ panic ! ( "miri evaluated to {}, but ctfe yielded {}" , bits == 0 , b) ;
841
841
} else if bits == 1 && !b {
842
- warn ! ( "miri evaluated to {}, but ctfe yielded {}" , bits == 1 , b) ;
842
+ panic ! ( "miri evaluated to {}, but ctfe yielded {}" , bits == 1 , b) ;
843
843
} else {
844
- warn ! ( "miri evaluated to {}, but expected a bool {}" , bits, b) ;
844
+ panic ! ( "miri evaluated to {}, but expected a bool {}" , bits, b) ;
845
845
}
846
846
}
847
847
( PrimVal :: Bytes ( bits) , & TyChar , ConstVal :: Char ( c) ) => {
848
848
if let Some ( cm) = :: std:: char:: from_u32 ( bits as u32 ) {
849
849
if cm != c {
850
- warn ! ( "miri evaluated to {:?}, but expected {:?}" , cm, c) ;
850
+ panic ! ( "miri evaluated to {:?}, but expected {:?}" , cm, c) ;
851
851
}
852
852
} else {
853
- warn ! ( "miri evaluated to {}, but expected a char {:?}" , bits, c) ;
853
+ panic ! ( "miri evaluated to {}, but expected a char {:?}" , bits, c) ;
854
854
}
855
855
}
856
856
_ => {
857
- info ! ( "can't check whether miri's {:?} ({}) makes sense when ctfe yields {:?}" ,
857
+ panic ! ( "can't check whether miri's {:?} ({}) makes sense when ctfe yields {:?}" ,
858
858
miri_val,
859
859
miri_ty,
860
860
ctfe)
0 commit comments