@@ -18,7 +18,7 @@ use rustc_data_structures::indexed_vec::Idx;
1818use rustc_data_structures:: sync:: Lrc ;
1919
2020use base;
21- use common:: { CodegenCx , C_null , C_undef , C_usize } ;
21+ use common:: { CodegenCx , C_undef , C_usize } ;
2222use builder:: { Builder , MemFlags } ;
2323use value:: Value ;
2424use type_of:: LayoutLlvmExt ;
@@ -411,7 +411,10 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
411411 . unwrap_or_else ( |err| {
412412 match constant. literal {
413413 mir:: Literal :: Promoted { .. } => {
414- // FIXME: generate a panic here
414+ // this is unreachable as long as runtime
415+ // and compile-time agree on values
416+ // With floats that won't always be true
417+ // so we generate an abort below
415418 } ,
416419 mir:: Literal :: Value { .. } => {
417420 err. report_as_error (
@@ -420,10 +423,12 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
420423 ) ;
421424 } ,
422425 }
426+ let fnname = bx. cx . get_intrinsic ( & ( "llvm.trap" ) ) ;
427+ bx. call ( fnname, & [ ] , None ) ;
423428 // We've errored, so we don't have to produce working code.
424429 let layout = bx. cx . layout_of ( ty) ;
425430 PlaceRef :: new_sized (
426- C_null ( layout. llvm_type ( bx. cx ) . ptr_to ( ) ) ,
431+ C_undef ( layout. llvm_type ( bx. cx ) . ptr_to ( ) ) ,
427432 layout,
428433 layout. align ,
429434 ) . load ( bx)
0 commit comments