Awesome Reviewers

Reviewer · Configurations

Gate unstable configuration consistently

New configurable behavior (CLI options, manifest keys, and any lints/warnings they trigger) must be introduced through the standard `-Z` unstable mechanism, and that gating must be applied consistently everywhere the feature has an effect.

Instruction

New configurable behavior (CLI options, manifest keys, and any lints/warnings they trigger) must be introduced through the standard -Z unstable mechanism, and that gating must be applied consistently everywhere the feature has an effect.

  • Prefer extending an existing config/option (e.g. folding a new setting into build.build-std rather than inventing a parallel option) unless the new behavior is semantically distinct enough to warrant its own -Z flag; don’t add a new unstable flag just because gating via the general unstable-options switch feels awkward.
  • Use the shared helpers for erroring on stable (e.g. cli_unstable().fail_if_stable_opt(...)) instead of hand-rolled checks, so error messages and behavior stay uniform across options.
  • When a feature produces secondary effects such as a new lint or warning (e.g. unexpected_cfgs), the same feature_gate must be attached to that effect too — don’t gate only the data acquisition (like fetching check-cfgs) while leaving the lint itself ungated, or it will leak onto stable.
  • Removing a -Z flag can be done directly (following rustc’s precedent) without extra process, as long as it isn’t a stabilization.
  • When computing defaults based on release channel (e.g. enabling something only on nightly/dev), account for RUSTC_BOOTSTRAP=1, which makes the channel appear as dev even on stable/beta toolchains. Use a canonical channel check (e.g. release_channel == Some("nightly")) or explicitly exclude the bootstrap-override case so unstable defaults don’t silently activate for users who only set RUSTC_BOOTSTRAP to unlock a specific unstable feature.

Example of preferring the shared helper:

if lockfile_path.is_some() {
    gctx.cli_unstable().fail_if_stable_opt("--lockfile-path", 5707)?;
}

instead of a manual if !gctx.cli_unstable().unstable_options { bail!(...) } check.