abi_check: tweak some comments · Amanieu/rust@f01bbfc (original) (raw)
`@@ -35,8 +35,6 @@ fn do_check_simd_vector_abi<'tcx>(
`
35
35
`is_call: bool,
`
36
36
`loc: impl Fn() -> (Span, HirId),
`
37
37
`) {
`
38
``
`-
// We check this on all functions, including those using the "Rust" ABI.
`
39
``
`-
// For the "Rust" ABI it would be a bug if the lint ever triggered, but better safe than sorry.
`
40
38
`let feature_def = tcx.sess.target.features_for_correct_vector_abi();
`
41
39
`let codegen_attrs = tcx.codegen_fn_attrs(def_id);
`
42
40
`let have_feature = |feat: Symbol| {
`
`@@ -123,8 +121,9 @@ fn do_check_wasm_abi<'tcx>(
`
123
121
`is_call: bool,
`
124
122
`loc: impl Fn() -> (Span, HirId),
`
125
123
`) {
`
126
``
`` -
// 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),
``
127
``
`` -
// and only proceed if wasm_c_abi_opt indicates we should emit the lint.
``
``
124
`` +
// Only proceed for extern "C" fn on wasm32-unknown-unknown (same check as what
``
``
125
`` +
// adjust_for_foreign_abi uses to call compute_wasm_abi_info), and only proceed if
``
``
126
`` +
// wasm_c_abi_opt indicates we should emit the lint.
``
128
127
`if !(tcx.sess.target.arch == "wasm32"
`
129
128
` && tcx.sess.target.os == "unknown"
`
130
129
` && 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>) {
`
157
156
`else {
`
158
157
`// An error will be reported during codegen if we cannot determine the ABI of this
`
159
158
`// function.
`
``
159
`+
tcx.dcx().delayed_bug("ABI computation failure should lead to compilation failure");
`
160
160
`return;
`
161
161
`};
`
``
162
`+
// Unlike the call-site check, we do also check "Rust" ABI functions here.
`
``
163
`+
// This should never trigger, except if we start making use of vector registers
`
``
164
`+
// for the "Rust" ABI and the user disables those vector registers (which should trigger a
`
``
165
`+
// warning as that's clearly disabling a "required" target feature for this target).
`
``
166
`+
// Using such a function is where disabling the vector register actually can start leading
`
``
167
`+
// to soundness issues, so erroring here seems good.
`
162
168
`let loc = || {
`
163
169
`let def_id = instance.def_id();
`
164
170
`(
`
`@@ -179,7 +185,8 @@ fn check_call_site_abi<'tcx>(
`
179
185
`loc: impl Fn() -> (Span, HirId) + Copy,
`
180
186
`) {
`
181
187
`if callee.fn_sig(tcx).abi().is_rustic_abi() {
`
182
``
`-
// we directly handle the soundness of Rust ABIs
`
``
188
`+
// We directly handle the soundness of Rust ABIs -- so let's skip the majority of
`
``
189
`+
// call sites to avoid a perf regression.
`
183
190
`return;
`
184
191
`}
`
185
192
`let typing_env = ty::TypingEnv::fully_monomorphized();
`