diff options
| author | bors <bors@rust-lang.org> | 2023-10-26 17:35:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-10-26 17:35:23 +0000 |
| commit | 8396efecf7d30ca9f7edcf76aba2ea388300f6ab (patch) | |
| tree | ed8e51672d07e7f546ea7dce8fac167872cd77e7 /compiler/rustc_session/src | |
| parent | 698db856de0b67313ddcb96b6599598058489ea9 (diff) | |
| parent | a461de73099102ab1b50e6d66390c55b288aede0 (diff) | |
| download | rust-8396efecf7d30ca9f7edcf76aba2ea388300f6ab.tar.gz rust-8396efecf7d30ca9f7edcf76aba2ea388300f6ab.zip | |
Auto merge of #117228 - matthiaskrgr:rollup-23zzepv, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #116905 (refactor(compiler/resolve): simplify some code) - #117095 (Add way to differentiate argument locals from other locals in Stable MIR) - #117143 (Avoid unbounded O(n^2) when parsing nested type args) - #117194 (Minor improvements to `rustc_incremental`) - #117202 (Revert "Remove TaKO8Ki from reviewers") - #117207 (The value of `-Cinstrument-coverage=` doesn't need to be `Option`) - #117214 (Quietly fail if an error has already occurred) - #117221 (Rename type flag `HAS_TY_GENERATOR` to `HAS_TY_COROUTINE`) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/config.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_session/src/options.rs | 18 |
2 files changed, 14 insertions, 16 deletions
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 78e410488c3..7aced414ed6 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -2743,13 +2743,11 @@ pub fn build_session_options( // This is what prevents them from being used on stable compilers. match cg.instrument_coverage { // Stable values: - Some(InstrumentCoverage::All | InstrumentCoverage::Off) | None => {} + InstrumentCoverage::All | InstrumentCoverage::Off => {} // Unstable values: - Some( - InstrumentCoverage::Branch - | InstrumentCoverage::ExceptUnusedFunctions - | InstrumentCoverage::ExceptUnusedGenerics, - ) => { + InstrumentCoverage::Branch + | InstrumentCoverage::ExceptUnusedFunctions + | InstrumentCoverage::ExceptUnusedGenerics => { if !unstable_opts.unstable_options { handler.early_error( "`-C instrument-coverage=branch` and `-C instrument-coverage=except-*` \ @@ -2759,7 +2757,7 @@ pub fn build_session_options( } } - if cg.instrument_coverage.is_some() && cg.instrument_coverage != Some(InstrumentCoverage::Off) { + if cg.instrument_coverage != InstrumentCoverage::Off { if cg.profile_generate.enabled() || cg.profile_use.is_some() { handler.early_error( "option `-C instrument-coverage` is not compatible with either `-C profile-use` \ diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 35c167837e5..fd473acbd3c 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -294,7 +294,7 @@ impl CodegenOptions { // JUSTIFICATION: defn of the suggested wrapper fn #[allow(rustc::bad_opt_access)] pub fn instrument_coverage(&self) -> InstrumentCoverage { - self.instrument_coverage.unwrap_or(InstrumentCoverage::Off) + self.instrument_coverage } } @@ -913,23 +913,23 @@ mod parse { } pub(crate) fn parse_instrument_coverage( - slot: &mut Option<InstrumentCoverage>, + slot: &mut InstrumentCoverage, v: Option<&str>, ) -> bool { if v.is_some() { - let mut bool_arg = None; - if parse_opt_bool(&mut bool_arg, v) { - *slot = bool_arg.unwrap().then_some(InstrumentCoverage::All); + let mut bool_arg = false; + if parse_bool(&mut bool_arg, v) { + *slot = if bool_arg { InstrumentCoverage::All } else { InstrumentCoverage::Off }; return true; } } let Some(v) = v else { - *slot = Some(InstrumentCoverage::All); + *slot = InstrumentCoverage::All; return true; }; - *slot = Some(match v { + *slot = match v { "all" => InstrumentCoverage::All, "branch" => InstrumentCoverage::Branch, "except-unused-generics" | "except_unused_generics" => { @@ -940,7 +940,7 @@ mod parse { } "off" | "no" | "n" | "false" | "0" => InstrumentCoverage::Off, _ => return false, - }); + }; true } @@ -1352,7 +1352,7 @@ options! { inline_threshold: Option<u32> = (None, parse_opt_number, [TRACKED], "set the threshold for inlining a function"), #[rustc_lint_opt_deny_field_access("use `Session::instrument_coverage` instead of this field")] - instrument_coverage: Option<InstrumentCoverage> = (None, parse_instrument_coverage, [TRACKED], + instrument_coverage: InstrumentCoverage = (InstrumentCoverage::Off, parse_instrument_coverage, [TRACKED], "instrument the generated code to support LLVM source-based code coverage \ reports (note, the compiler build config must include `profiler = true`); \ implies `-C symbol-mangling-version=v0`. Optional values are: |
