Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-lang/rust
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf4da49bdaf6febb6404eac1e787e7cb36e54ec2
Choose a base ref
..
head repository: rust-lang/rust
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1c86e0978c1b9bcea986ba84ee3d6049b0f2c411
Choose a head ref
Showing with 6 additions and 6 deletions.
  1. +6 −6 compiler/rustc_mir_transform/src/coverage/graph.rs
12 changes: 6 additions & 6 deletions compiler/rustc_mir_transform/src/coverage/graph.rs
Original file line number Diff line number Diff line change
@@ -78,15 +78,15 @@ impl CoverageGraph {
let mut bb_to_bcb = IndexVec::from_elem_n(None, num_basic_blocks);

let mut add_basic_coverage_block = |basic_blocks: &mut Vec<BasicBlock>| {
// Take the accumulated list of blocks as a boxed slice, but leave
// the vector's capacity intact to be reused for subsequent BCBs.
let basic_blocks: Box<[BasicBlock]> = basic_blocks.split_off(0).into();
// Take the accumulated list of blocks, leaving the vector empty
// to be used by subsequent BCBs.
let basic_blocks = std::mem::take(basic_blocks);

let bcb = bcbs.next_index();
for &bb in basic_blocks.iter() {
bb_to_bcb[bb] = Some(bcb);
}
let bcb_data = BasicCoverageBlockData::new(basic_blocks);
let bcb_data = BasicCoverageBlockData::from(basic_blocks);
debug!("adding bcb{}: {:?}", bcb.index(), bcb_data);
bcbs.push(bcb_data);
};
@@ -274,11 +274,11 @@ rustc_index::newtype_index! {
/// significance.
#[derive(Debug, Clone)]
pub(super) struct BasicCoverageBlockData {
pub basic_blocks: Box<[BasicBlock]>,
pub basic_blocks: Vec<BasicBlock>,
}

impl BasicCoverageBlockData {
pub fn new(basic_blocks: Box<[BasicBlock]>) -> Self {
pub fn from(basic_blocks: Vec<BasicBlock>) -> Self {
assert!(basic_blocks.len() > 0);
Self { basic_blocks }
}