about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-12-07 17:57:58 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2021-12-07 17:57:58 +0100
commit7d34d3ad78ca3db6197eee8d4f5d9e7b8876ff20 (patch)
tree47841dc58d6a25b68c2f2abb57fe6a8e5a5e50fc
parentdf7f02072b64712e5322ea70675135cb1e20bf80 (diff)
parente05ad7f8199f0da52892d96f37c72581f1f56e87 (diff)
downloadrust-7d34d3ad78ca3db6197eee8d4f5d9e7b8876ff20.tar.gz
rust-7d34d3ad78ca3db6197eee8d4f5d9e7b8876ff20.zip
Sync from rust c5c94945096265b6d675b2f55a247c4799de8d87
-rw-r--r--scripts/cargo.rs4
-rw-r--r--src/abi/pass_mode.rs2
-rw-r--r--src/base.rs22
3 files changed, 19 insertions, 9 deletions
diff --git a/scripts/cargo.rs b/scripts/cargo.rs
index 89ec8da77d3..41d82b581cd 100644
--- a/scripts/cargo.rs
+++ b/scripts/cargo.rs
@@ -42,7 +42,7 @@ fn main() {
                 "RUSTFLAGS",
                 env::var("RUSTFLAGS").unwrap_or(String::new()) + " -Cprefer-dynamic",
             );
-            std::array::IntoIter::new(["rustc".to_string()])
+            IntoIterator::into_iter(["rustc".to_string()])
                 .chain(env::args().skip(2))
                 .chain([
                     "--".to_string(),
@@ -56,7 +56,7 @@ fn main() {
                 "RUSTFLAGS",
                 env::var("RUSTFLAGS").unwrap_or(String::new()) + " -Cprefer-dynamic",
             );
-            std::array::IntoIter::new(["rustc".to_string()])
+            IntoIterator::into_iter(["rustc".to_string()])
                 .chain(env::args().skip(2))
                 .chain([
                     "--".to_string(),
diff --git a/src/abi/pass_mode.rs b/src/abi/pass_mode.rs
index 2a9b399b9ed..c01ed249904 100644
--- a/src/abi/pass_mode.rs
+++ b/src/abi/pass_mode.rs
@@ -71,7 +71,7 @@ fn cast_target_to_abi_params(cast: CastTarget) -> SmallVec<[AbiParam; 2]> {
         .prefix
         .iter()
         .flatten()
-        .map(|&kind| reg_to_abi_param(Reg { kind, size: cast.prefix_chunk_size }))
+        .map(|&reg| reg_to_abi_param(reg))
         .chain((0..rest_count).map(|_| reg_to_abi_param(cast.rest.unit)))
         .collect::<SmallVec<_>>();
 
diff --git a/src/base.rs b/src/base.rs
index a1d06851277..f3dd2bf6a3c 100644
--- a/src/base.rs
+++ b/src/base.rs
@@ -1,6 +1,7 @@
 //! Codegen of a single function
 
 use cranelift_codegen::binemit::{NullStackMapSink, NullTrapSink};
+use rustc_ast::InlineAsmOptions;
 use rustc_index::vec::IndexVec;
 use rustc_middle::ty::adjustment::PointerCast;
 use rustc_middle::ty::layout::FnAbiOf;
@@ -236,7 +237,8 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, '_>) {
             fx.add_comment(inst, terminator_head);
         }
 
-        fx.set_debug_loc(bb_data.terminator().source_info);
+        let source_info = bb_data.terminator().source_info;
+        fx.set_debug_loc(source_info);
 
         match &bb_data.terminator().kind {
             TerminatorKind::Goto { target } => {
@@ -292,19 +294,19 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, '_>) {
                         let len = codegen_operand(fx, len).load_scalar(fx);
                         let index = codegen_operand(fx, index).load_scalar(fx);
                         let location = fx
-                            .get_caller_location(bb_data.terminator().source_info.span)
+                            .get_caller_location(source_info.span)
                             .load_scalar(fx);
 
                         codegen_panic_inner(
                             fx,
                             rustc_hir::LangItem::PanicBoundsCheck,
                             &[index, len, location],
-                            bb_data.terminator().source_info.span,
+                            source_info.span,
                         );
                     }
                     _ => {
                         let msg_str = msg.description();
-                        codegen_panic(fx, msg_str, bb_data.terminator().source_info.span);
+                        codegen_panic(fx, msg_str, source_info.span);
                     }
                 }
             }
@@ -375,10 +377,18 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, '_>) {
                 options,
                 destination,
                 line_spans: _,
+                cleanup: _,
             } => {
+                if options.contains(InlineAsmOptions::MAY_UNWIND) {
+                    fx.tcx.sess.span_fatal(
+                        source_info.span,
+                        "cranelift doesn't support unwinding from inline assembly.",
+                    );
+                }
+
                 crate::inline_asm::codegen_inline_asm(
                     fx,
-                    bb_data.terminator().source_info.span,
+                    source_info.span,
                     template,
                     operands,
                     *options,
@@ -412,7 +422,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, '_>) {
             }
             TerminatorKind::Drop { place, target, unwind: _ } => {
                 let drop_place = codegen_place(fx, *place);
-                crate::abi::codegen_drop(fx, bb_data.terminator().source_info.span, drop_place);
+                crate::abi::codegen_drop(fx, source_info.span, drop_place);
 
                 let target_block = fx.get_block(*target);
                 fx.bcx.ins().jump(target_block, &[]);