@@ -17,7 +17,7 @@ use rustc::ty::layout::{self, Align, LayoutOf, TyLayout};
1717use rustc_data_structures:: indexed_vec:: Idx ;
1818
1919use base;
20- use common:: { self , CodegenCx , C_null , C_undef , C_usize } ;
20+ use common:: { self , CodegenCx , C_undef , C_usize } ;
2121use builder:: { Builder , MemFlags } ;
2222use value:: Value ;
2323use type_of:: LayoutLlvmExt ;
@@ -413,7 +413,10 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
413413 . unwrap_or_else ( |err| {
414414 match constant. literal {
415415 mir:: Literal :: Promoted { .. } => {
416- // FIXME: generate a panic here
416+ // this is unreachable as long as runtime
417+ // and compile-time agree on values
418+ // With floats that won't always be true
419+ // so we generate an abort below
417420 } ,
418421 mir:: Literal :: Value { .. } => {
419422 err. report_as_error (
@@ -422,10 +425,12 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
422425 ) ;
423426 } ,
424427 }
428+ let fnname = bx. cx . get_intrinsic ( & ( "llvm.trap" ) ) ;
429+ bx. call ( fnname, & [ ] , None ) ;
425430 // We've errored, so we don't have to produce working code.
426431 let layout = bx. cx . layout_of ( ty) ;
427432 PlaceRef :: new_sized (
428- C_null ( layout. llvm_type ( bx. cx ) . ptr_to ( ) ) ,
433+ C_undef ( layout. llvm_type ( bx. cx ) . ptr_to ( ) ) ,
429434 layout,
430435 layout. align ,
431436 ) . load ( bx)
0 commit comments