Skip to content

Commit

Permalink
Unrolled build for rust-lang#123439
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#123439 - Zalathar:constants, r=oli-obk

coverage: Remove useless constants

After rust-lang#122972 and rust-lang#123419, these constants don't serve any useful purpose, so get rid of them.

`@rustbot` label +A-code-coverage
  • Loading branch information
rust-timer authored Apr 4, 2024
2 parents ca7d34e + e08fdb0 commit ce88e28
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ pub(crate) mod ffi;
pub(crate) mod map_data;
pub mod mapgen;

const VAR_ALIGN: Align = Align::EIGHT;

/// A context object for maintaining all state needed by the coverageinfo module.
pub struct CrateCoverageContext<'ll, 'tcx> {
/// Coverage data for each instrumented function identified by DefId.
Expand Down Expand Up @@ -226,7 +224,8 @@ pub(crate) fn save_cov_data_to_mod<'ll, 'tcx>(
llvm::set_global_constant(llglobal, true);
llvm::set_linkage(llglobal, llvm::Linkage::PrivateLinkage);
llvm::set_section(llglobal, &covmap_section_name);
llvm::set_alignment(llglobal, VAR_ALIGN);
// LLVM's coverage mapping format specifies 8-byte alignment for items in this section.
llvm::set_alignment(llglobal, Align::EIGHT);
cx.add_used_global(llglobal);
}

Expand Down Expand Up @@ -256,7 +255,8 @@ pub(crate) fn save_func_record_to_mod<'ll, 'tcx>(
llvm::set_linkage(llglobal, llvm::Linkage::LinkOnceODRLinkage);
llvm::set_visibility(llglobal, llvm::Visibility::Hidden);
llvm::set_section(llglobal, covfun_section_name);
llvm::set_alignment(llglobal, VAR_ALIGN);
// LLVM's coverage mapping format specifies 8-byte alignment for items in this section.
llvm::set_alignment(llglobal, Align::EIGHT);
llvm::set_comdat(cx.llmod, llglobal, &func_record_var_name);
cx.add_used_global(llglobal);
}
Expand Down
8 changes: 0 additions & 8 deletions compiler/rustc_middle/src/mir/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ rustc_index::newtype_index! {
pub struct CounterId {}
}

impl CounterId {
pub const START: Self = Self::ZERO;
}

rustc_index::newtype_index! {
/// ID of a coverage-counter expression. Values ascend from 0.
///
Expand All @@ -55,10 +51,6 @@ rustc_index::newtype_index! {
pub struct ExpressionId {}
}

impl ExpressionId {
pub const START: Self = Self::ZERO;
}

/// Enum that can hold a constant zero value, the ID of an physical coverage
/// counter, or the ID of a coverage-counter expression.
///
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/coverage/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fn coverage_ids_info<'tcx>(
_ => None,
})
.max()
.unwrap_or(CounterId::START);
.unwrap_or(CounterId::ZERO);

CoverageIdsInfo { max_counter_id }
}
Expand Down

0 comments on commit ce88e28

Please sign in to comment.