rust/compiler/rustc_mir_transform/src
Matthias Krüger 418ae3e9a0
Rollup merge of #118852 - Zalathar:no-spans, r=cjgillot
coverage: Skip instrumenting a function if no spans were extracted from MIR

The immediate symptoms of #118643 were fixed by #118666, but some users reported that their builds now encounter another coverage-related ICE:

```
error: internal compiler error: compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs:98:17: A used function should have had coverage mapping data but did not: (...)
```

I was able to reproduce at least one cause of this error: if no relevant spans could be extracted from a function, but the function contains `CoverageKind::SpanMarker` statements, then codegen still thinks the function is instrumented and complains about the fact that it has no coverage spans.

This PR prevents that from happening in two ways:
- If we didn't extract any relevant spans from MIR, skip instrumenting the entire function and don't create a `FunctionCoverateInfo` for it.
- If coverage codegen sees a `CoverageKind::SpanMarker` statement, skip it early and avoid creating `func_coverage`.

---

Fixes #118850.
2023-12-18 08:08:22 +01:00
..
coverage coverage: Skip instrumenting a function if no spans were extracted 2023-12-16 11:10:10 +11:00
inline subst -> instantiate 2023-09-26 09:37:55 +02:00
abort_unwinding_calls.rs remove redundant imports 2023-12-10 10:56:22 +08:00
add_call_guards.rs remove redundant imports 2023-12-10 10:56:22 +08:00
add_moves_for_packed_drops.rs remove redundant imports 2023-12-10 10:56:22 +08:00
add_retag.rs remove redundant imports 2023-12-10 10:56:22 +08:00
add_subtyping_projections.rs remove redundant imports 2023-12-10 10:56:22 +08:00
check_alignment.rs remove redundant imports 2023-12-10 10:56:22 +08:00
check_const_item_mutation.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
check_packed_ref.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
check_unsafety.rs Rename HandlerInner::delay_span_bug as HandlerInner::span_delayed_bug. 2023-12-02 09:01:19 +11:00
cleanup_post_borrowck.rs rename BorrowKind::Shallow to Fake 2023-11-08 22:55:28 +01:00
const_debuginfo.rs Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
const_goto.rs remove redundant imports 2023-12-10 10:56:22 +08:00
const_prop.rs remove redundant imports 2023-12-10 10:56:22 +08:00
const_prop_lint.rs merge DefKind::Coroutine into DefKind::Closure 2023-11-26 21:05:08 +08:00
copy_prop.rs remove redundant imports 2023-12-10 10:56:22 +08:00
coroutine.rs Remove redundant special case for resume argument 2023-12-11 23:11:20 +01:00
cost_checker.rs Re-format code with new rustfmt 2023-11-15 21:45:48 -05:00
cross_crate_inline.rs Fix cases where std accidentally relied on inline(never) 2023-12-14 08:30:36 -05:00
ctfe_limit.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
dataflow_const_prop.rs NFC don't convert types to identical types 2023-12-15 23:56:24 +01:00
dead_store_elimination.rs Preserve DebugInfo in DeadStoreElimination. 2023-10-06 15:46:11 +00:00
deduce_param_attrs.rs deduce_param_attrs: explain a read-only case 2023-10-30 10:29:08 +01:00
deduplicate_blocks.rs remove redundant imports 2023-12-10 10:56:22 +08:00
deref_separator.rs remove redundant imports 2023-12-10 10:56:22 +08:00
dest_prop.rs s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
dump_mir.rs Write to stdout if - is given as output file 2023-06-06 17:53:29 -04:00
early_otherwise_branch.rs add some comments explaining why MIR opts are marked as unsound 2023-10-10 11:17:27 +02:00
elaborate_box_derefs.rs remove redundant imports 2023-12-10 10:56:22 +08:00
elaborate_drops.rs remove redundant imports 2023-12-10 10:56:22 +08:00
errors.rs Simplify lint decorator derive too 2023-12-16 02:07:01 +00:00
ffi_unwind_calls.rs s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
function_item_references.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
gvn.rs Avoid overflow in GVN constant indexing. 2023-12-17 19:50:38 +00:00
inline.rs remove redundant imports 2023-12-10 10:56:22 +08:00
instsimplify.rs remove redundant imports 2023-12-10 10:56:22 +08:00
jump_threading.rs clippy::complexity fixes 2023-12-12 19:28:13 +01:00
large_enums.rs remove redundant imports 2023-12-10 10:56:22 +08:00
lib.rs Rename HandlerInner::delay_span_bug as HandlerInner::span_delayed_bug. 2023-12-02 09:01:19 +11:00
lower_intrinsics.rs remove redundant imports 2023-12-10 10:56:22 +08:00
lower_slice_len.rs remove redundant imports 2023-12-10 10:56:22 +08:00
match_branches.rs remove redundant imports 2023-12-10 10:56:22 +08:00
multiple_return_terminators.rs remove redundant imports 2023-12-10 10:56:22 +08:00
normalize_array_len.rs remove redundant imports 2023-12-10 10:56:22 +08:00
nrvo.rs add some comments explaining why MIR opts are marked as unsound 2023-10-10 11:17:27 +02:00
pass_manager.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
prettify.rs remove redundant imports 2023-12-10 10:56:22 +08:00
ref_prop.rs remove redundant imports 2023-12-10 10:56:22 +08:00
remove_noop_landing_pads.rs remove redundant imports 2023-12-10 10:56:22 +08:00
remove_place_mention.rs remove redundant imports 2023-12-10 10:56:22 +08:00
remove_storage_markers.rs remove redundant imports 2023-12-10 10:56:22 +08:00
remove_uninit_drops.rs remove redundant imports 2023-12-10 10:56:22 +08:00
remove_unneeded_drops.rs remove redundant imports 2023-12-10 10:56:22 +08:00
remove_zsts.rs remove redundant imports 2023-12-10 10:56:22 +08:00
required_consts.rs rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00
reveal_all.rs remove redundant imports 2023-12-10 10:56:22 +08:00
separate_const_switch.rs remove redundant imports 2023-12-10 10:56:22 +08:00
shim.rs Fix coroutine validation for mixed panic strategy 2023-11-28 21:11:24 +01:00
simplify.rs remove redundant imports 2023-12-10 10:56:22 +08:00
simplify_branches.rs remove redundant imports 2023-12-10 10:56:22 +08:00
simplify_comparison_integral.rs rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00
sroa.rs remove redundant imports 2023-12-10 10:56:22 +08:00
ssa.rs Fix def-use check for call terminators 2023-11-14 17:07:34 +01:00
uninhabited_enum_branching.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
unreachable_prop.rs remove redundant imports 2023-12-10 10:56:22 +08:00