You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #117199 - Zalathar:instrument-coverage-on, r=oli-obk,Nadrieril
Change the documented implicit value of `-C instrument-coverage` to `=yes`
The option-value parser for `-Cinstrument-coverage=` currently accepts the following stable values:
- `all` (implicit value of plain `-Cinstrument-coverage`)
- `yes`, `y`, `on`, `true` (undocumented aliases for `all`)
- `off` (default; same as not specifying `-Cinstrument-coverage`)
- `no`, `n`, `false`, `0` (undocumented aliases for `off`)
I'd like to rearrange and re-document the stable values as follows:
- `no` (default; same as not specifying `-Cinstrument-coverage`)
- `n`, `off`, `false` (documented aliases for `no`)
- `0` (undocumented alias for `no`)
- `yes` (implicit value of plain `-Cinstrument-coverage`)
- `y`, `on`, `true` (documented aliases for `yes`)
- `all` (documented as *currently* an alias for `yes` that may change; discouraged but not deprecated)
The main changes being:
- Documented default value changes from `off` to `no`
- Documented implicit value changes from `all` to `yes`
- Other boolean aliases (`n`, `off`, `false`, `y`, `on`, `true`) are explicitly documented
- `all` remains currently an alias for `yes`, but is explicitly documented as being able to change in the future
- `0` remains an undocumented but stable alias for `no`
- The actual behaviour of coverage instrumentation does not change
# Why?
The choice of `all` as the implicit value only really makes sense in the context of the unstable `except-unused-functions` and `except-unused-generics` values. That arrangement was fine for an unstable flag, but it's confusing for a stable flag whose only other stable value is `off`, and will only become more confusing if we eventually want to stabilize other fine-grained coverage option values.
(Currently I'm not aware of any plans to stabilize other coverage option values, but that's why I think now is a fine time to make this change, well before anyone actually has to care about it.)
For example, if we ever add support for opt-in instrumentation of things that are *not* instrumented by `-Cinstrument-coverage` by default, it will be very strange for the `all` value to not actually instrument all things that we know how to instrument.
# Compatibility impact
Because this is not a functional change, there is no immediate compatibility impact. However, changing the documented semantics of `all` opens up the possibility of future changes that could be considered retroactively breaking.
I don't think this is going to be a big deal in practice, for a few reasons:
- The exact behaviour of coverage instrumentation is allowed to change, so changing the behaviour of `all` is not a *stability-breaking* change, as long as it still exists and does something reasonable.
- `-Cinstrument-coverage` is mainly used by tools or scripts that can be easily updated if necessary. It's unusual for users to pass the flag directly, because processing the profiler output is complicated enough that tools/scripts tend to be necessary anyway.
- Most people who are using coverage are probably relying on `-Cinstrument-coverage` rather than explicitly passing `-Cinstrument-coverage=all`, so the number of users actually affected by this change is likely to be low, and plausibly zero.
pubconst parse_dump_mono_stats:&str = "`markdown` (default) or `json`";
397
-
pubconst parse_instrument_coverage:&str =
398
-
"`all` (default), `branch`, `except-unused-generics`, `except-unused-functions`, or `off`";
397
+
pubconst parse_instrument_coverage:&str = "either a boolean (`yes`, `no`, `on`, `off`, etc) or (unstable) one of `branch`, `except-unused-generics`, `except-unused-functions`";
399
398
pubconst parse_instrument_xray:&str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit`";
400
399
pubconst parse_unpretty:&str = "`string` or `string=string`";
401
400
pubconst parse_treat_err_as_bug:&str = "either no value or a non-negative number";
@@ -918,26 +917,26 @@ mod parse {
918
917
if v.is_some(){
919
918
letmut bool_arg = false;
920
919
ifparse_bool(&mut bool_arg, v){
921
-
*slot = if bool_arg {InstrumentCoverage::All}else{InstrumentCoverage::Off};
920
+
*slot = if bool_arg {InstrumentCoverage::Yes}else{InstrumentCoverage::No};
Copy file name to clipboardexpand all lines: src/doc/rustc/src/instrument-coverage.md
+23-4
Original file line number
Diff line number
Diff line change
@@ -331,10 +331,29 @@ $ llvm-cov report \
331
331
332
332
## `-C instrument-coverage=<options>`
333
333
334
-
-`-C instrument-coverage=all`: Instrument all functions, including unused functions and unused generics. (This is the same as `-C instrument-coverage`, with no value.)
335
-
-`-C instrument-coverage=off`: Do not instrument any functions. (This is the same as simply not including the `-C instrument-coverage` option.)
336
-
-`-Zunstable-options -C instrument-coverage=except-unused-generics`: Instrument all functions except unused generics.
337
-
-`-Zunstable-options -C instrument-coverage=except-unused-functions`: Instrument only used (called) functions and instantiated generic functions.
error: incorrect value `bad-value` for codegen option `instrument-coverage` - `all` (default), `branch`, `except-unused-generics`, `except-unused-functions`, or `off` was expected
1
+
error: incorrect value `bad-value` for codegen option `instrument-coverage` - either a boolean (`yes`, `no`, `on`, `off`, etc) or (unstable) one of `branch`, `except-unused-generics`, `except-unused-functions` was expected
error: incorrect value `` for codegen option `instrument-coverage` - `all` (default), `branch`, `except-unused-generics`, `except-unused-functions`, or `off` was expected
1
+
error: incorrect value `` for codegen option `instrument-coverage` - either a boolean (`yes`, `no`, `on`, `off`, etc) or (unstable) one of `branch`, `except-unused-generics`, `except-unused-functions` was expected
0 commit comments