diff options
| author | bors <bors@rust-lang.org> | 2025-01-24 19:04:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-01-24 19:04:36 +0000 |
| commit | 1e9b0177da38e3f421a3b9b1942f1777d166e06a (patch) | |
| tree | 9dbb946c94a729493ccff8edaaa9643bbcb4021c /compiler/rustc_mir_transform/src/coverage/mod.rs | |
| parent | 8231e8599e238ff4e717639bd68c6abb8579fe8d (diff) | |
| parent | ed77bf72631cfb310a09842ac0317ae49d675283 (diff) | |
| download | rust-1e9b0177da38e3f421a3b9b1942f1777d166e06a.tar.gz rust-1e9b0177da38e3f421a3b9b1942f1777d166e06a.zip | |
Auto merge of #136000 - matthiaskrgr:rollup-j6ge32r, r=matthiaskrgr
Rollup of 6 pull requests
Successful merges:
- #135873 (coverage: Prepare for upcoming changes to counter creation)
- #135926 (Implement `needs-subprocess` directive, and cleanup a bunch of tests to use `needs-{subprocess,threads}`)
- #135950 (Tidy Python improvements)
- #135956 (Make `Vec::pop_if` a bit more presentable)
- #135966 ([AIX] Allow different sized load and store in `tests/assembly/powerpc64-struct-abi.rs`)
- #135983 (Doc difference between extend and extend_from_slice)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/mod.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/coverage/mod.rs | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/compiler/rustc_mir_transform/src/coverage/mod.rs b/compiler/rustc_mir_transform/src/coverage/mod.rs index 19568735df7..b8aa76a7dbe 100644 --- a/compiler/rustc_mir_transform/src/coverage/mod.rs +++ b/compiler/rustc_mir_transform/src/coverage/mod.rs @@ -180,7 +180,12 @@ fn create_mappings( )); for (decision, branches) in mcdc_mappings { - let num_conditions = branches.len() as u16; + // FIXME(#134497): Previously it was possible for some of these branch + // conversions to fail, in which case the remaining branches in the + // decision would be degraded to plain `MappingKind::Branch`. + // The changes in #134497 made that failure impossible, because the + // fallible step was deferred to codegen. But the corresponding code + // in codegen wasn't updated to detect the need for a degrade step. let conditions = branches .into_iter() .map( @@ -206,24 +211,13 @@ fn create_mappings( ) .collect::<Vec<_>>(); - if conditions.len() == num_conditions as usize { - // LLVM requires end index for counter mapping regions. - let kind = MappingKind::MCDCDecision(DecisionInfo { - bitmap_idx: (decision.bitmap_idx + decision.num_test_vectors) as u32, - num_conditions, - }); - let span = decision.span; - mappings.extend(std::iter::once(Mapping { kind, span }).chain(conditions.into_iter())); - } else { - mappings.extend(conditions.into_iter().map(|mapping| { - let MappingKind::MCDCBranch { true_term, false_term, mcdc_params: _ } = - mapping.kind - else { - unreachable!("all mappings here are MCDCBranch as shown above"); - }; - Mapping { kind: MappingKind::Branch { true_term, false_term }, span: mapping.span } - })) - } + // LLVM requires end index for counter mapping regions. + let kind = MappingKind::MCDCDecision(DecisionInfo { + bitmap_idx: (decision.bitmap_idx + decision.num_test_vectors) as u32, + num_conditions: u16::try_from(conditions.len()).unwrap(), + }); + let span = decision.span; + mappings.extend(std::iter::once(Mapping { kind, span }).chain(conditions.into_iter())); } mappings |
