Replace some Option<Span> with Span and use DUMMY_SP instead of None

This commit is contained in:
Oli Scherer
2025-06-04 06:26:56 +00:00
parent 81a964c23e
commit fd3da4bebd
77 changed files with 250 additions and 250 deletions

View File

@@ -380,7 +380,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
rustc_hir::LangItem::PanicBoundsCheck,
&[index, len, location],
*unwind,
Some(source_info.span),
source_info.span,
);
}
AssertKind::MisalignedPointerDereference { ref required, ref found } => {
@@ -393,7 +393,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
rustc_hir::LangItem::PanicMisalignedPointerDereference,
&[required, found, location],
*unwind,
Some(source_info.span),
source_info.span,
);
}
AssertKind::NullPointerDereference => {
@@ -404,7 +404,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
rustc_hir::LangItem::PanicNullPointerDereference,
&[location],
*unwind,
Some(source_info.span),
source_info.span,
)
}
_ => {
@@ -415,7 +415,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
msg.panic_function(),
&[location],
*unwind,
Some(source_info.span),
source_info.span,
);
}
}
@@ -531,7 +531,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
);
}
TerminatorKind::UnwindTerminate(reason) => {
codegen_unwind_terminate(fx, Some(source_info.span), *reason);
codegen_unwind_terminate(fx, source_info.span, *reason);
}
TerminatorKind::UnwindResume => {
// FIXME implement unwinding
@@ -1074,7 +1074,7 @@ pub(crate) fn codegen_operand<'tcx>(
pub(crate) fn codegen_panic_nounwind<'tcx>(
fx: &mut FunctionCx<'_, '_, 'tcx>,
msg_str: &str,
span: Option<Span>,
span: Span,
) {
let msg_ptr = fx.anonymous_str(msg_str);
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>(
pub(crate) fn codegen_unwind_terminate<'tcx>(
fx: &mut FunctionCx<'_, '_, 'tcx>,
span: Option<Span>,
span: Span,
reason: UnwindTerminateReason,
) {
codegen_panic_inner(fx, reason.lang_item(), &[], UnwindAction::Unreachable, span);
@@ -1102,7 +1102,7 @@ fn codegen_panic_inner<'tcx>(
lang_item: rustc_hir::LangItem,
args: &[Value],
_unwind: UnwindAction,
span: Option<Span>,
span: Span,
) {
fx.bcx.set_cold_block(fx.bcx.current_block().unwrap());

View File

@@ -71,7 +71,7 @@ pub(crate) fn codegen_llvm_intrinsic_call<'tcx>(
See https://github.com/rust-lang/rustc_codegen_cranelift/issues/171\n\
Please open an issue at https://github.com/rust-lang/rustc_codegen_cranelift/issues"
);
crate::base::codegen_panic_nounwind(fx, &msg, None);
crate::base::codegen_panic_nounwind(fx, &msg, span);
return;
}
}

View File

@@ -512,7 +512,7 @@ pub(super) fn codegen_aarch64_llvm_intrinsic_call<'tcx>(
See https://github.com/rust-lang/rustc_codegen_cranelift/issues/171\n\
Please open an issue at https://github.com/rust-lang/rustc_codegen_cranelift/issues"
);
crate::base::codegen_panic_nounwind(fx, &msg, None);
crate::base::codegen_panic_nounwind(fx, &msg, fx.mir.span);
return;
}
}

View File

@@ -1321,7 +1321,7 @@ pub(super) fn codegen_x86_llvm_intrinsic_call<'tcx>(
See https://github.com/rust-lang/rustc_codegen_cranelift/issues/171\n\
Please open an issue at https://github.com/rust-lang/rustc_codegen_cranelift/issues"
);
crate::base::codegen_panic_nounwind(fx, &msg, None);
crate::base::codegen_panic_nounwind(fx, &msg, span);
return;
}
}

View File

@@ -785,7 +785,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
}
})
});
crate::base::codegen_panic_nounwind(fx, &msg_str, Some(source_info.span));
crate::base::codegen_panic_nounwind(fx, &msg_str, source_info.span);
return Ok(());
}
}
@@ -884,7 +884,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
crate::base::codegen_panic_nounwind(
fx,
"128bit atomics not yet supported",
None,
source_info.span,
);
return Ok(());
} else {
@@ -919,7 +919,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
crate::base::codegen_panic_nounwind(
fx,
"128bit atomics not yet supported",
None,
source_info.span,
);
return Ok(());
} else {

View File

@@ -101,7 +101,7 @@ pub(crate) fn maybe_create_entry_wrapper(
let call_inst = bcx.ins().call(main_func_ref, &[]);
let call_results = bcx.func.dfg.inst_results(call_inst).to_owned();
let termination_trait = tcx.require_lang_item(LangItem::Termination, None);
let termination_trait = tcx.require_lang_item(LangItem::Termination, DUMMY_SP);
let report = tcx
.associated_items(termination_trait)
.find_by_ident_and_kind(
@@ -136,7 +136,7 @@ pub(crate) fn maybe_create_entry_wrapper(
}
} else {
// Regular main fn invoked via start lang item.
let start_def_id = tcx.require_lang_item(LangItem::Start, None);
let start_def_id = tcx.require_lang_item(LangItem::Start, DUMMY_SP);
let start_instance = Instance::expect_resolve(
tcx,
ty::TypingEnv::fully_monomorphized(),

View File

@@ -54,7 +54,7 @@ fn codegen_three_way_compare<'tcx>(
let gt = fx.bcx.ins().icmp(gt_cc, lhs, rhs);
let lt = fx.bcx.ins().icmp(lt_cc, lhs, rhs);
let val = fx.bcx.ins().isub(gt, lt);
CValue::by_val(val, fx.layout_of(fx.tcx.ty_ordering_enum(Some(fx.mir.span))))
CValue::by_val(val, fx.layout_of(fx.tcx.ty_ordering_enum(fx.mir.span)))
}
fn codegen_compare_bin_op<'tcx>(

View File

@@ -240,7 +240,7 @@ pub(crate) fn size_and_align_of<'tcx>(
})
});
codegen_panic_nounwind(fx, &msg_str, None);
codegen_panic_nounwind(fx, &msg_str, fx.mir.span);
fx.bcx.switch_to_block(next_block);