Skip to content

Commit a98c7df

Browse files
authored
Unrolled build for rust-lang#117111
Rollup merge of rust-lang#117111 - Zalathar:zinstrument, r=compiler-errors Remove support for alias `-Z instrument-coverage` This flag was stabilized in rustc 1.60.0 (2022-04-07) as `-C instrument-coverage`, but the old unstable flag was kept around (with a warning) as an alias to ease migration. It should now be reasonable to remove the somewhat tricky code that implemented that alias. Fixes rust-lang#116980.
2 parents cf226e9 + 65b0f6a commit a98c7df

9 files changed

+25
-39
lines changed

compiler/rustc_interface/src/tests.rs

-1
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,6 @@ fn test_unstable_options_tracking_hash() {
789789
tracked!(inline_mir, Some(true));
790790
tracked!(inline_mir_hint_threshold, Some(123));
791791
tracked!(inline_mir_threshold, Some(123));
792-
tracked!(instrument_coverage, Some(InstrumentCoverage::All));
793792
tracked!(instrument_mcount, true);
794793
tracked!(instrument_xray, Some(InstrumentXRay::default()));
795794
tracked!(link_directives, false);

compiler/rustc_session/src/config.rs

+17-22
Original file line numberDiff line numberDiff line change
@@ -2739,29 +2739,24 @@ pub fn build_session_options(
27392739
_ => {}
27402740
}
27412741

2742-
// Handle both `-Z instrument-coverage` and `-C instrument-coverage`; the latter takes
2743-
// precedence.
2744-
match (cg.instrument_coverage, unstable_opts.instrument_coverage) {
2745-
(Some(ic_c), Some(ic_z)) if ic_c != ic_z => {
2746-
handler.early_error(
2747-
"incompatible values passed for `-C instrument-coverage` \
2748-
and `-Z instrument-coverage`",
2749-
);
2750-
}
2751-
(Some(InstrumentCoverage::Off | InstrumentCoverage::All), _) => {}
2752-
(Some(_), _) if !unstable_opts.unstable_options => {
2753-
handler.early_error(
2754-
"`-C instrument-coverage=branch` and `-C instrument-coverage=except-*` \
2755-
require `-Z unstable-options`",
2756-
);
2757-
}
2758-
(None, None) => {}
2759-
(None, ic) => {
2760-
handler
2761-
.early_warn("`-Z instrument-coverage` is deprecated; use `-C instrument-coverage`");
2762-
cg.instrument_coverage = ic;
2742+
// Check for unstable values of `-C instrument-coverage`.
2743+
// This is what prevents them from being used on stable compilers.
2744+
match cg.instrument_coverage {
2745+
// Stable values:
2746+
Some(InstrumentCoverage::All | InstrumentCoverage::Off) | None => {}
2747+
// Unstable values:
2748+
Some(
2749+
InstrumentCoverage::Branch
2750+
| InstrumentCoverage::ExceptUnusedFunctions
2751+
| InstrumentCoverage::ExceptUnusedGenerics,
2752+
) => {
2753+
if !unstable_opts.unstable_options {
2754+
handler.early_error(
2755+
"`-C instrument-coverage=branch` and `-C instrument-coverage=except-*` \
2756+
require `-Z unstable-options`",
2757+
);
2758+
}
27632759
}
2764-
_ => {}
27652760
}
27662761

27672762
if cg.instrument_coverage.is_some() && cg.instrument_coverage != Some(InstrumentCoverage::Off) {

compiler/rustc_session/src/options.rs

-10
Original file line numberDiff line numberDiff line change
@@ -1593,16 +1593,6 @@ options! {
15931593
"a default MIR inlining threshold (default: 50)"),
15941594
input_stats: bool = (false, parse_bool, [UNTRACKED],
15951595
"gather statistics about the input (default: no)"),
1596-
#[rustc_lint_opt_deny_field_access("use `Session::instrument_coverage` instead of this field")]
1597-
instrument_coverage: Option<InstrumentCoverage> = (None, parse_instrument_coverage, [TRACKED],
1598-
"instrument the generated code to support LLVM source-based code coverage \
1599-
reports (note, the compiler build config must include `profiler = true`); \
1600-
implies `-C symbol-mangling-version=v0`. Optional values are:
1601-
`=all` (implicit value)
1602-
`=branch`
1603-
`=except-unused-generics`
1604-
`=except-unused-functions`
1605-
`=off` (default)"),
16061596
instrument_mcount: bool = (false, parse_bool, [TRACKED],
16071597
"insert function instrument code for mcount-based tracing (default: no)"),
16081598
instrument_xray: Option<InstrumentXRay> = (None, parse_instrument_xray, [TRACKED],

tests/ui/instrument-coverage/except-unused-functions.rs

-3
This file was deleted.

tests/ui/instrument-coverage/except-unused-generics.rs

-3
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
error: `-C instrument-coverage=branch` and `-C instrument-coverage=except-*` require `-Z unstable-options`
2+
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// revisions: branch except-unused-functions except-unused-generics
2+
// [branch] compile-flags: -Cinstrument-coverage=branch
3+
// [except-unused-functions] compile-flags: -Cinstrument-coverage=except-unused-functions
4+
// [except-unused-generics] compile-flags: -Cinstrument-coverage=except-unused-generics
5+
6+
fn main() {}

0 commit comments

Comments
 (0)