abi_check: tweak some comments
This commit is contained in:
parent
321db85fb4
commit
f01bbfc5e7
1 changed files with 12 additions and 5 deletions
|
|
@ -35,8 +35,6 @@ fn do_check_simd_vector_abi<'tcx>(
|
|||
is_call: bool,
|
||||
loc: impl Fn() -> (Span, HirId),
|
||||
) {
|
||||
// We check this on all functions, including those using the "Rust" ABI.
|
||||
// For the "Rust" ABI it would be a bug if the lint ever triggered, but better safe than sorry.
|
||||
let feature_def = tcx.sess.target.features_for_correct_vector_abi();
|
||||
let codegen_attrs = tcx.codegen_fn_attrs(def_id);
|
||||
let have_feature = |feat: Symbol| {
|
||||
|
|
@ -123,8 +121,9 @@ fn do_check_wasm_abi<'tcx>(
|
|||
is_call: bool,
|
||||
loc: impl Fn() -> (Span, HirId),
|
||||
) {
|
||||
// Only proceed for `extern "C" fn` on wasm32-unknown-unknown (same check as what `adjust_for_foreign_abi` uses to call `compute_wasm_abi_info`),
|
||||
// and only proceed if `wasm_c_abi_opt` indicates we should emit the lint.
|
||||
// Only proceed for `extern "C" fn` on wasm32-unknown-unknown (same check as what
|
||||
// `adjust_for_foreign_abi` uses to call `compute_wasm_abi_info`), and only proceed if
|
||||
// `wasm_c_abi_opt` indicates we should emit the lint.
|
||||
if !(tcx.sess.target.arch == "wasm32"
|
||||
&& tcx.sess.target.os == "unknown"
|
||||
&& tcx.wasm_c_abi_opt() == WasmCAbi::Legacy { with_lint: true }
|
||||
|
|
@ -157,8 +156,15 @@ fn check_instance_abi<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) {
|
|||
else {
|
||||
// An error will be reported during codegen if we cannot determine the ABI of this
|
||||
// function.
|
||||
tcx.dcx().delayed_bug("ABI computation failure should lead to compilation failure");
|
||||
return;
|
||||
};
|
||||
// Unlike the call-site check, we do also check "Rust" ABI functions here.
|
||||
// This should never trigger, *except* if we start making use of vector registers
|
||||
// for the "Rust" ABI and the user disables those vector registers (which should trigger a
|
||||
// warning as that's clearly disabling a "required" target feature for this target).
|
||||
// Using such a function is where disabling the vector register actually can start leading
|
||||
// to soundness issues, so erroring here seems good.
|
||||
let loc = || {
|
||||
let def_id = instance.def_id();
|
||||
(
|
||||
|
|
@ -179,7 +185,8 @@ fn check_call_site_abi<'tcx>(
|
|||
loc: impl Fn() -> (Span, HirId) + Copy,
|
||||
) {
|
||||
if callee.fn_sig(tcx).abi().is_rustic_abi() {
|
||||
// we directly handle the soundness of Rust ABIs
|
||||
// We directly handle the soundness of Rust ABIs -- so let's skip the majority of
|
||||
// call sites to avoid a perf regression.
|
||||
return;
|
||||
}
|
||||
let typing_env = ty::TypingEnv::fully_monomorphized();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue