Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7d34d3a

Browse files
committed
Sync from rust c5c9494
2 parents df7f020 + e05ad7f commit 7d34d3a

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

scripts/cargo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn main() {
4242
"RUSTFLAGS",
4343
env::var("RUSTFLAGS").unwrap_or(String::new()) + " -Cprefer-dynamic",
4444
);
45-
std::array::IntoIter::new(["rustc".to_string()])
45+
IntoIterator::into_iter(["rustc".to_string()])
4646
.chain(env::args().skip(2))
4747
.chain([
4848
"--".to_string(),
@@ -56,7 +56,7 @@ fn main() {
5656
"RUSTFLAGS",
5757
env::var("RUSTFLAGS").unwrap_or(String::new()) + " -Cprefer-dynamic",
5858
);
59-
std::array::IntoIter::new(["rustc".to_string()])
59+
IntoIterator::into_iter(["rustc".to_string()])
6060
.chain(env::args().skip(2))
6161
.chain([
6262
"--".to_string(),

src/abi/pass_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn cast_target_to_abi_params(cast: CastTarget) -> SmallVec<[AbiParam; 2]> {
7171
.prefix
7272
.iter()
7373
.flatten()
74-
.map(|&kind| reg_to_abi_param(Reg { kind, size: cast.prefix_chunk_size }))
74+
.map(|&reg| reg_to_abi_param(reg))
7575
.chain((0..rest_count).map(|_| reg_to_abi_param(cast.rest.unit)))
7676
.collect::<SmallVec<_>>();
7777

src/base.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Codegen of a single function
22
33
use cranelift_codegen::binemit::{NullStackMapSink, NullTrapSink};
4+
use rustc_ast::InlineAsmOptions;
45
use rustc_index::vec::IndexVec;
56
use rustc_middle::ty::adjustment::PointerCast;
67
use rustc_middle::ty::layout::FnAbiOf;
@@ -236,7 +237,8 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, '_>) {
236237
fx.add_comment(inst, terminator_head);
237238
}
238239

239-
fx.set_debug_loc(bb_data.terminator().source_info);
240+
let source_info = bb_data.terminator().source_info;
241+
fx.set_debug_loc(source_info);
240242

241243
match &bb_data.terminator().kind {
242244
TerminatorKind::Goto { target } => {
@@ -292,19 +294,19 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, '_>) {
292294
let len = codegen_operand(fx, len).load_scalar(fx);
293295
let index = codegen_operand(fx, index).load_scalar(fx);
294296
let location = fx
295-
.get_caller_location(bb_data.terminator().source_info.span)
297+
.get_caller_location(source_info.span)
296298
.load_scalar(fx);
297299

298300
codegen_panic_inner(
299301
fx,
300302
rustc_hir::LangItem::PanicBoundsCheck,
301303
&[index, len, location],
302-
bb_data.terminator().source_info.span,
304+
source_info.span,
303305
);
304306
}
305307
_ => {
306308
let msg_str = msg.description();
307-
codegen_panic(fx, msg_str, bb_data.terminator().source_info.span);
309+
codegen_panic(fx, msg_str, source_info.span);
308310
}
309311
}
310312
}
@@ -375,10 +377,18 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, '_>) {
375377
options,
376378
destination,
377379
line_spans: _,
380+
cleanup: _,
378381
} => {
382+
if options.contains(InlineAsmOptions::MAY_UNWIND) {
383+
fx.tcx.sess.span_fatal(
384+
source_info.span,
385+
"cranelift doesn't support unwinding from inline assembly.",
386+
);
387+
}
388+
379389
crate::inline_asm::codegen_inline_asm(
380390
fx,
381-
bb_data.terminator().source_info.span,
391+
source_info.span,
382392
template,
383393
operands,
384394
*options,
@@ -412,7 +422,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, '_>) {
412422
}
413423
TerminatorKind::Drop { place, target, unwind: _ } => {
414424
let drop_place = codegen_place(fx, *place);
415-
crate::abi::codegen_drop(fx, bb_data.terminator().source_info.span, drop_place);
425+
crate::abi::codegen_drop(fx, source_info.span, drop_place);
416426

417427
let target_block = fx.get_block(*target);
418428
fx.bcx.ins().jump(target_block, &[]);

0 commit comments

Comments
 (0)