@@ -335,7 +335,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
335335 TerminatorKind :: Return => {
336336 crate :: abi:: codegen_return ( fx) ;
337337 }
338- TerminatorKind :: Assert { cond, expected, msg, target, cleanup : _ } => {
338+ TerminatorKind :: Assert { cond, expected, msg, target, unwind : _ } => {
339339 if !fx. tcx . sess . overflow_checks ( ) && msg. is_optional_overflow_check ( ) {
340340 let target = fx. get_block ( * target) ;
341341 fx. bcx . ins ( ) . jump ( target, & [ ] ) ;
@@ -369,6 +369,18 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
369369 source_info. span ,
370370 ) ;
371371 }
372+ AssertKind :: MisalignedPointerDereference { ref required, ref found } => {
373+ let required = codegen_operand ( fx, required) . load_scalar ( fx) ;
374+ let found = codegen_operand ( fx, found) . load_scalar ( fx) ;
375+ let location = fx. get_caller_location ( source_info) . load_scalar ( fx) ;
376+
377+ codegen_panic_inner (
378+ fx,
379+ rustc_hir:: LangItem :: PanicBoundsCheck ,
380+ & [ required, found, location] ,
381+ source_info. span ,
382+ ) ;
383+ }
372384 _ => {
373385 let msg_str = msg. description ( ) ;
374386 codegen_panic ( fx, msg_str, source_info) ;
@@ -428,7 +440,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
428440 destination,
429441 target,
430442 fn_span,
431- cleanup : _,
443+ unwind : _,
432444 from_hir_call : _,
433445 } => {
434446 fx. tcx . prof . generic_activity ( "codegen call" ) . run ( || {
@@ -448,7 +460,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
448460 options,
449461 destination,
450462 line_spans : _,
451- cleanup : _,
463+ unwind : _,
452464 } => {
453465 if options. contains ( InlineAsmOptions :: MAY_UNWIND ) {
454466 fx. tcx . sess . span_fatal (
@@ -466,7 +478,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
466478 * destination,
467479 ) ;
468480 }
469- TerminatorKind :: Abort => {
481+ TerminatorKind :: Terminate => {
470482 codegen_panic_cannot_unwind ( fx, source_info) ;
471483 }
472484 TerminatorKind :: Resume => {
@@ -784,14 +796,15 @@ fn codegen_stmt<'tcx>(
784796 if active_field_index. is_some ( ) {
785797 assert_eq ! ( operands. len( ) , 1 ) ;
786798 }
787- for ( i, operand) in operands. iter ( ) . enumerate ( ) {
799+ for ( i, operand) in operands. iter_enumerated ( ) {
788800 let operand = codegen_operand ( fx, operand) ;
789801 let field_index = active_field_index. unwrap_or ( i) ;
790802 let to = if let mir:: AggregateKind :: Array ( _) = * * kind {
791- let index = fx. bcx . ins ( ) . iconst ( fx. pointer_type , field_index as i64 ) ;
803+ let array_index = i64:: from ( field_index. as_u32 ( ) ) ;
804+ let index = fx. bcx . ins ( ) . iconst ( fx. pointer_type , array_index) ;
792805 variant_dest. place_index ( fx, index)
793806 } else {
794- variant_dest. place_field ( fx, mir :: Field :: new ( field_index) )
807+ variant_dest. place_field ( fx, field_index)
795808 } ;
796809 to. write_cvalue ( fx, operand) ;
797810 }
0 commit comments