Skip to content

Commit 59549af

Browse files
committed
Replace some Option<Span> with Span and use DUMMY_SP instead of None
1 parent 57d0559 commit 59549af

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

src/base.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
380380
rustc_hir::LangItem::PanicBoundsCheck,
381381
&[index, len, location],
382382
*unwind,
383-
Some(source_info.span),
383+
source_info.span,
384384
);
385385
}
386386
AssertKind::MisalignedPointerDereference { ref required, ref found } => {
@@ -393,7 +393,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
393393
rustc_hir::LangItem::PanicMisalignedPointerDereference,
394394
&[required, found, location],
395395
*unwind,
396-
Some(source_info.span),
396+
source_info.span,
397397
);
398398
}
399399
AssertKind::NullPointerDereference => {
@@ -404,7 +404,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
404404
rustc_hir::LangItem::PanicNullPointerDereference,
405405
&[location],
406406
*unwind,
407-
Some(source_info.span),
407+
source_info.span,
408408
)
409409
}
410410
_ => {
@@ -415,7 +415,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
415415
msg.panic_function(),
416416
&[location],
417417
*unwind,
418-
Some(source_info.span),
418+
source_info.span,
419419
);
420420
}
421421
}
@@ -531,7 +531,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
531531
);
532532
}
533533
TerminatorKind::UnwindTerminate(reason) => {
534-
codegen_unwind_terminate(fx, Some(source_info.span), *reason);
534+
codegen_unwind_terminate(fx, source_info.span, *reason);
535535
}
536536
TerminatorKind::UnwindResume => {
537537
// FIXME implement unwinding
@@ -1074,7 +1074,7 @@ pub(crate) fn codegen_operand<'tcx>(
10741074
pub(crate) fn codegen_panic_nounwind<'tcx>(
10751075
fx: &mut FunctionCx<'_, '_, 'tcx>,
10761076
msg_str: &str,
1077-
span: Option<Span>,
1077+
span: Span,
10781078
) {
10791079
let msg_ptr = fx.anonymous_str(msg_str);
10801080
let msg_len = fx.bcx.ins().iconst(fx.pointer_type, i64::try_from(msg_str.len()).unwrap());
@@ -1091,7 +1091,7 @@ pub(crate) fn codegen_panic_nounwind<'tcx>(
10911091

10921092
pub(crate) fn codegen_unwind_terminate<'tcx>(
10931093
fx: &mut FunctionCx<'_, '_, 'tcx>,
1094-
span: Option<Span>,
1094+
span: Span,
10951095
reason: UnwindTerminateReason,
10961096
) {
10971097
codegen_panic_inner(fx, reason.lang_item(), &[], UnwindAction::Unreachable, span);
@@ -1102,7 +1102,7 @@ fn codegen_panic_inner<'tcx>(
11021102
lang_item: rustc_hir::LangItem,
11031103
args: &[Value],
11041104
_unwind: UnwindAction,
1105-
span: Option<Span>,
1105+
span: Span,
11061106
) {
11071107
fx.bcx.set_cold_block(fx.bcx.current_block().unwrap());
11081108

src/intrinsics/llvm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub(crate) fn codegen_llvm_intrinsic_call<'tcx>(
7171
See https://github.com/rust-lang/rustc_codegen_cranelift/issues/171\n\
7272
Please open an issue at https://github.com/rust-lang/rustc_codegen_cranelift/issues"
7373
);
74-
crate::base::codegen_panic_nounwind(fx, &msg, None);
74+
crate::base::codegen_panic_nounwind(fx, &msg, span);
7575
return;
7676
}
7777
}

src/intrinsics/llvm_aarch64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ pub(super) fn codegen_aarch64_llvm_intrinsic_call<'tcx>(
512512
See https://github.com/rust-lang/rustc_codegen_cranelift/issues/171\n\
513513
Please open an issue at https://github.com/rust-lang/rustc_codegen_cranelift/issues"
514514
);
515-
crate::base::codegen_panic_nounwind(fx, &msg, None);
515+
crate::base::codegen_panic_nounwind(fx, &msg, fx.mir.span);
516516
return;
517517
}
518518
}

src/intrinsics/llvm_x86.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ pub(super) fn codegen_x86_llvm_intrinsic_call<'tcx>(
13211321
See https://github.com/rust-lang/rustc_codegen_cranelift/issues/171\n\
13221322
Please open an issue at https://github.com/rust-lang/rustc_codegen_cranelift/issues"
13231323
);
1324-
crate::base::codegen_panic_nounwind(fx, &msg, None);
1324+
crate::base::codegen_panic_nounwind(fx, &msg, span);
13251325
return;
13261326
}
13271327
}

src/intrinsics/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
785785
}
786786
})
787787
});
788-
crate::base::codegen_panic_nounwind(fx, &msg_str, Some(source_info.span));
788+
crate::base::codegen_panic_nounwind(fx, &msg_str, source_info.span);
789789
return Ok(());
790790
}
791791
}
@@ -884,7 +884,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
884884
crate::base::codegen_panic_nounwind(
885885
fx,
886886
"128bit atomics not yet supported",
887-
None,
887+
source_info.span,
888888
);
889889
return Ok(());
890890
} else {
@@ -919,7 +919,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
919919
crate::base::codegen_panic_nounwind(
920920
fx,
921921
"128bit atomics not yet supported",
922-
None,
922+
source_info.span,
923923
);
924924
return Ok(());
925925
} else {

src/main_shim.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub(crate) fn maybe_create_entry_wrapper(
101101
let call_inst = bcx.ins().call(main_func_ref, &[]);
102102
let call_results = bcx.func.dfg.inst_results(call_inst).to_owned();
103103

104-
let termination_trait = tcx.require_lang_item(LangItem::Termination, None);
104+
let termination_trait = tcx.require_lang_item(LangItem::Termination, DUMMY_SP);
105105
let report = tcx
106106
.associated_items(termination_trait)
107107
.find_by_ident_and_kind(
@@ -136,7 +136,7 @@ pub(crate) fn maybe_create_entry_wrapper(
136136
}
137137
} else {
138138
// Regular main fn invoked via start lang item.
139-
let start_def_id = tcx.require_lang_item(LangItem::Start, None);
139+
let start_def_id = tcx.require_lang_item(LangItem::Start, DUMMY_SP);
140140
let start_instance = Instance::expect_resolve(
141141
tcx,
142142
ty::TypingEnv::fully_monomorphized(),

src/num.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn codegen_three_way_compare<'tcx>(
5454
let gt = fx.bcx.ins().icmp(gt_cc, lhs, rhs);
5555
let lt = fx.bcx.ins().icmp(lt_cc, lhs, rhs);
5656
let val = fx.bcx.ins().isub(gt, lt);
57-
CValue::by_val(val, fx.layout_of(fx.tcx.ty_ordering_enum(Some(fx.mir.span))))
57+
CValue::by_val(val, fx.layout_of(fx.tcx.ty_ordering_enum(fx.mir.span)))
5858
}
5959

6060
fn codegen_compare_bin_op<'tcx>(

src/unsize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ pub(crate) fn size_and_align_of<'tcx>(
240240
})
241241
});
242242

243-
codegen_panic_nounwind(fx, &msg_str, None);
243+
codegen_panic_nounwind(fx, &msg_str, fx.mir.span);
244244

245245
fx.bcx.switch_to_block(next_block);
246246

0 commit comments

Comments
 (0)