@@ -18,7 +18,7 @@ use rustc_data_structures::indexed_vec::Idx;
18
18
use rustc_data_structures:: sync:: Lrc ;
19
19
20
20
use base;
21
- use common:: { CodegenCx , C_null , C_undef , C_usize } ;
21
+ use common:: { CodegenCx , C_undef , C_usize } ;
22
22
use builder:: { Builder , MemFlags } ;
23
23
use value:: Value ;
24
24
use type_of:: LayoutLlvmExt ;
@@ -411,7 +411,10 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
411
411
. unwrap_or_else ( |err| {
412
412
match constant. literal {
413
413
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
415
418
} ,
416
419
mir:: Literal :: Value { .. } => {
417
420
err. report_as_error (
@@ -420,10 +423,12 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
420
423
) ;
421
424
} ,
422
425
}
426
+ let fnname = bx. cx . get_intrinsic ( & ( "llvm.trap" ) ) ;
427
+ bx. call ( fnname, & [ ] , None ) ;
423
428
// We've errored, so we don't have to produce working code.
424
429
let layout = bx. cx . layout_of ( ty) ;
425
430
PlaceRef :: new_sized (
426
- C_null ( layout. llvm_type ( bx. cx ) . ptr_to ( ) ) ,
431
+ C_undef ( layout. llvm_type ( bx. cx ) . ptr_to ( ) ) ,
427
432
layout,
428
433
layout. align ,
429
434
) . load ( bx)
0 commit comments