Skip to content

Commit 015e937

Browse files
Rollup merge of #123940 - kornelski:remove-derived-debug, r=Urgau
debug-fmt-detail option I'd like to propose a new option that makes `#[derive(Debug)]` generate no-op implementations that don't print anything, and makes `{:?}` in format strings a no-op. There are a couple of motivations for this: 1. A more thorough stripping of debug symbols. Binaries stripped of debug symbols still retain some of them through `Debug` implementations. It's hard to avoid that without compiler's help, because debug formatting can be used in many places, including dependencies, and their loggers, asserts, panics, etc. * In my testing it gives about 2% binary size reduction on top of all other binary-minimizing best practices (including `panic_immediate_abort`). There are targets like Web WASM or embedded where users pay attention to binary sizes. * Users distributing closed-source binaries may not want to "leak" any symbol names as a matter of principle. 2. Adds ability to test whether code depends on specifics of the `Debug` format implementation in unwise ways (e.g. trying to get data unavailable via public interface, or using it as a serialization format). Because current Rust's debug implementation doesn't change, there's a risk of it becoming a fragile de-facto API that [won't be possible to change in the future](https://www.hyrumslaw.com/). An option that "breaks" it can act as a [grease](https://www.rfc-editor.org/rfc/rfc8701.html). This implementation is a `-Z fmt-debug=opt` flag that takes: * `full` — the default, current state. * `none` — makes derived `Debug` and `{:?}` no-ops. Explicit `impl Debug for T` implementations are left unharmed, but `{:?}` format won't use them, so they may get dead-code eliminated if they aren't invoked directly. * `shallow` — makes derived `Debug` print only the type's name, without recursing into fields. Fieldless enums print their variant names. `{:?}` works. The `shallow` option is a compromise between minimizing the `Debug` code, and compatibility. There are popular proc-macro crates that use `Debug::fmt` as a way to convert enum values into their Rust source code. There's a corresponding `cfg` flag: `#[cfg(fmt_debug = "none")]` that can be used in user code to react to this setting to minimize custom `Debug` implementations or remove unnecessary formatting helper functions.
2 parents 6cf068d + 88b9edc commit 015e937

38 files changed

+285
-56
lines changed

compiler/rustc_ast_lowering/src/format.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ use std::borrow::Cow;
44
use rustc_ast::visit::Visitor;
55
use rustc_ast::*;
66
use rustc_data_structures::fx::FxIndexMap;
7+
use rustc_hir as hir;
8+
use rustc_session::config::FmtDebug;
79
use rustc_span::symbol::{kw, Ident};
810
use rustc_span::{sym, Span, Symbol};
9-
use {rustc_ast as ast, rustc_hir as hir};
1011

1112
use super::LoweringContext;
1213

@@ -243,7 +244,10 @@ fn make_argument<'hir>(
243244
hir::LangItem::FormatArgument,
244245
match ty {
245246
Format(Display) => sym::new_display,
246-
Format(Debug) => sym::new_debug,
247+
Format(Debug) => match ctx.tcx.sess.opts.unstable_opts.fmt_debug {
248+
FmtDebug::Full | FmtDebug::Shallow => sym::new_debug,
249+
FmtDebug::None => sym::new_debug_noop,
250+
},
247251
Format(LowerExp) => sym::new_lower_exp,
248252
Format(UpperExp) => sym::new_upper_exp,
249253
Format(Octal) => sym::new_octal,

compiler/rustc_builtin_macros/src/deriving/debug.rs

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use rustc_ast::{self as ast, EnumDef, MetaItem};
22
use rustc_expand::base::{Annotatable, ExtCtxt};
3+
use rustc_session::config::FmtDebug;
34
use rustc_span::symbol::{sym, Ident, Symbol};
45
use rustc_span::Span;
56
use thin_vec::{thin_vec, ThinVec};
@@ -49,6 +50,11 @@ fn show_substructure(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) ->
4950
// We want to make sure we have the ctxt set so that we can use unstable methods
5051
let span = cx.with_def_site_ctxt(span);
5152

53+
let fmt_detail = cx.sess.opts.unstable_opts.fmt_debug;
54+
if fmt_detail == FmtDebug::None {
55+
return BlockOrExpr::new_expr(cx.expr_ok(span, cx.expr_tuple(span, ThinVec::new())));
56+
}
57+
5258
let (ident, vdata, fields) = match substr.fields {
5359
Struct(vdata, fields) => (substr.type_ident, *vdata, fields),
5460
EnumMatching(_, v, fields) => (v.ident, &v.data, fields),
@@ -61,6 +67,13 @@ fn show_substructure(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) ->
6167
let name = cx.expr_str(span, ident.name);
6268
let fmt = substr.nonselflike_args[0].clone();
6369

70+
// Fieldless enums have been special-cased earlier
71+
if fmt_detail == FmtDebug::Shallow {
72+
let fn_path_write_str = cx.std_path(&[sym::fmt, sym::Formatter, sym::write_str]);
73+
let expr = cx.expr_call_global(span, fn_path_write_str, thin_vec![fmt, name]);
74+
return BlockOrExpr::new_expr(expr);
75+
}
76+
6477
// Struct and tuples are similar enough that we use the same code for both,
6578
// with some extra pieces for structs due to the field names.
6679
let (is_struct, args_per_field) = match vdata {

compiler/rustc_feature/src/builtin_attrs.rs

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ const GATED_CFGS: &[GatedCfg] = &[
3737
(sym::relocation_model, sym::cfg_relocation_model, cfg_fn!(cfg_relocation_model)),
3838
(sym::sanitizer_cfi_generalize_pointers, sym::cfg_sanitizer_cfi, cfg_fn!(cfg_sanitizer_cfi)),
3939
(sym::sanitizer_cfi_normalize_integers, sym::cfg_sanitizer_cfi, cfg_fn!(cfg_sanitizer_cfi)),
40+
// this is consistent with naming of the compiler flag it's for
41+
(sym::fmt_debug, sym::fmt_debug, cfg_fn!(fmt_debug)),
4042
];
4143

4244
/// Find a gated cfg determined by the `pred`icate which is given the cfg's name.

compiler/rustc_feature/src/unstable.rs

+2
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,8 @@ declare_features! (
471471
(unstable, ffi_const, "1.45.0", Some(58328)),
472472
/// Allows the use of `#[ffi_pure]` on foreign functions.
473473
(unstable, ffi_pure, "1.45.0", Some(58329)),
474+
/// Controlling the behavior of fmt::Debug
475+
(unstable, fmt_debug, "CURRENT_RUSTC_VERSION", Some(129709)),
474476
/// Allows using `#[repr(align(...))]` on function items
475477
(unstable, fn_align, "1.53.0", Some(82232)),
476478
/// Support delegating implementation of functions to other already implemented functions.

compiler/rustc_interface/src/tests.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ use rustc_errors::{registry, ColorConfig};
1010
use rustc_session::config::{
1111
build_configuration, build_session_options, rustc_optgroups, BranchProtection, CFGuard, Cfg,
1212
CollapseMacroDebuginfo, CoverageLevel, CoverageOptions, DebugInfo, DumpMonoStatsFormat,
13-
ErrorOutputType, ExternEntry, ExternLocation, Externs, FunctionReturn, InliningThreshold,
14-
Input, InstrumentCoverage, InstrumentXRay, LinkSelfContained, LinkerPluginLto, LocationDetail,
15-
LtoCli, NextSolverConfig, OomStrategy, Options, OutFileName, OutputType, OutputTypes, PAuthKey,
16-
PacRet, Passes, PatchableFunctionEntry, Polonius, ProcMacroExecutionStrategy, Strip,
17-
SwitchWithOptPath, SymbolManglingVersion, WasiExecModel,
13+
ErrorOutputType, ExternEntry, ExternLocation, Externs, FmtDebug, FunctionReturn,
14+
InliningThreshold, Input, InstrumentCoverage, InstrumentXRay, LinkSelfContained,
15+
LinkerPluginLto, LocationDetail, LtoCli, NextSolverConfig, OomStrategy, Options, OutFileName,
16+
OutputType, OutputTypes, PAuthKey, PacRet, Passes, PatchableFunctionEntry, Polonius,
17+
ProcMacroExecutionStrategy, Strip, SwitchWithOptPath, SymbolManglingVersion, WasiExecModel,
1818
};
1919
use rustc_session::lint::Level;
2020
use rustc_session::search_paths::SearchPath;
@@ -780,6 +780,7 @@ fn test_unstable_options_tracking_hash() {
780780
tracked!(fewer_names, Some(true));
781781
tracked!(fixed_x18, true);
782782
tracked!(flatten_format_args, false);
783+
tracked!(fmt_debug, FmtDebug::Shallow);
783784
tracked!(force_unstable_if_unmarked, true);
784785
tracked!(fuel, Some(("abc".to_string(), 99)));
785786
tracked!(function_return, FunctionReturn::ThunkExtern);

compiler/rustc_session/src/config.rs

+22-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ use rustc_feature::UnstableFeatures;
2222
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
2323
use rustc_span::edition::{Edition, DEFAULT_EDITION, EDITION_NAME_LIST, LATEST_STABLE_EDITION};
2424
use rustc_span::source_map::FilePathMapping;
25-
use rustc_span::{FileName, FileNameDisplayPreference, RealFileName, SourceFileHashAlgorithm};
25+
use rustc_span::{
26+
sym, FileName, FileNameDisplayPreference, RealFileName, SourceFileHashAlgorithm, Symbol,
27+
};
2628
use rustc_target::spec::{
2729
FramePointer, LinkSelfContainedComponents, LinkerFeatures, SplitDebuginfo, Target, TargetTriple,
2830
};
@@ -402,6 +404,23 @@ impl LocationDetail {
402404
}
403405
}
404406

407+
/// Values for the `-Z fmt-debug` flag.
408+
#[derive(Copy, Clone, PartialEq, Hash, Debug)]
409+
pub enum FmtDebug {
410+
/// Derive fully-featured implementation
411+
Full,
412+
/// Print only type name, without fields
413+
Shallow,
414+
/// `#[derive(Debug)]` and `{:?}` are no-ops
415+
None,
416+
}
417+
418+
impl FmtDebug {
419+
pub(crate) fn all() -> [Symbol; 3] {
420+
[sym::full, sym::none, sym::shallow]
421+
}
422+
}
423+
405424
#[derive(Clone, PartialEq, Hash, Debug)]
406425
pub enum SwitchWithOptPath {
407426
Enabled(Option<PathBuf>),
@@ -2994,7 +3013,7 @@ pub(crate) mod dep_tracking {
29943013

29953014
use super::{
29963015
BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
2997-
CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FunctionReturn,
3016+
CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FmtDebug, FunctionReturn,
29983017
InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail,
29993018
LtoCli, NextSolverConfig, OomStrategy, OptLevel, OutFileName, OutputType, OutputTypes,
30003019
PatchableFunctionEntry, Polonius, RemapPathScopeComponents, ResolveDocLinks,
@@ -3088,6 +3107,7 @@ pub(crate) mod dep_tracking {
30883107
OutputType,
30893108
RealFileName,
30903109
LocationDetail,
3110+
FmtDebug,
30913111
BranchProtection,
30923112
OomStrategy,
30933113
LanguageIdentifier,

compiler/rustc_session/src/config/cfg.rs

+18-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use rustc_span::symbol::{sym, Symbol};
3131
use rustc_target::abi::Align;
3232
use rustc_target::spec::{PanicStrategy, RelocModel, SanitizerSet, Target, TargetTriple, TARGETS};
3333

34-
use crate::config::CrateType;
34+
use crate::config::{CrateType, FmtDebug};
3535
use crate::Session;
3636

3737
/// The parsed `--cfg` options that define the compilation environment of the
@@ -142,6 +142,7 @@ pub(crate) fn disallow_cfgs(sess: &Session, user_cfgs: &Cfg) {
142142
| (sym::target_has_atomic_equal_alignment, Some(_))
143143
| (sym::target_has_atomic_load_store, Some(_))
144144
| (sym::target_thread_local, None) => disallow(cfg, "--target"),
145+
(sym::fmt_debug, None | Some(_)) => disallow(cfg, "-Z fmt-debug"),
145146
_ => {}
146147
}
147148
}
@@ -179,6 +180,20 @@ pub(crate) fn default_configuration(sess: &Session) -> Cfg {
179180
ins_none!(sym::debug_assertions);
180181
}
181182

183+
if sess.is_nightly_build() {
184+
match sess.opts.unstable_opts.fmt_debug {
185+
FmtDebug::Full => {
186+
ins_sym!(sym::fmt_debug, sym::full);
187+
}
188+
FmtDebug::Shallow => {
189+
ins_sym!(sym::fmt_debug, sym::shallow);
190+
}
191+
FmtDebug::None => {
192+
ins_sym!(sym::fmt_debug, sym::none);
193+
}
194+
}
195+
}
196+
182197
if sess.overflow_checks() {
183198
ins_none!(sym::overflow_checks);
184199
}
@@ -326,6 +341,8 @@ impl CheckCfg {
326341

327342
ins!(sym::debug_assertions, no_values);
328343

344+
ins!(sym::fmt_debug, empty_values).extend(FmtDebug::all());
345+
329346
// These four are never set by rustc, but we set them anyway; they
330347
// should not trigger the lint because `cargo clippy`, `cargo doc`,
331348
// `cargo test`, `cargo miri run` and `cargo fmt` (respectively)

compiler/rustc_session/src/options.rs

+14
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ mod desc {
408408
pub const parse_linker_plugin_lto: &str =
409409
"either a boolean (`yes`, `no`, `on`, `off`, etc), or the path to the linker plugin";
410410
pub const parse_location_detail: &str = "either `none`, or a comma separated list of location details to track: `file`, `line`, or `column`";
411+
pub const parse_fmt_debug: &str = "either `full`, `shallow`, or `none`";
411412
pub const parse_switch_with_opt_path: &str =
412413
"an optional path to the profiling data output directory";
413414
pub const parse_merge_functions: &str = "one of: `disabled`, `trampolines`, or `aliases`";
@@ -589,6 +590,16 @@ mod parse {
589590
}
590591
}
591592

593+
pub(crate) fn parse_fmt_debug(opt: &mut FmtDebug, v: Option<&str>) -> bool {
594+
*opt = match v {
595+
Some("full") => FmtDebug::Full,
596+
Some("shallow") => FmtDebug::Shallow,
597+
Some("none") => FmtDebug::None,
598+
_ => return false,
599+
};
600+
true
601+
}
602+
592603
pub(crate) fn parse_location_detail(ld: &mut LocationDetail, v: Option<&str>) -> bool {
593604
if let Some(v) = v {
594605
ld.line = false;
@@ -1724,6 +1735,9 @@ options! {
17241735
flatten_format_args: bool = (true, parse_bool, [TRACKED],
17251736
"flatten nested format_args!() and literals into a simplified format_args!() call \
17261737
(default: yes)"),
1738+
fmt_debug: FmtDebug = (FmtDebug::Full, parse_fmt_debug, [TRACKED],
1739+
"how detailed `#[derive(Debug)]` should be. `full` prints types recursively, \
1740+
`shallow` prints only type names, `none` prints nothing and disables `{:?}`. (default: `full`)"),
17271741
force_unstable_if_unmarked: bool = (false, parse_bool, [TRACKED],
17281742
"force all crates to be `rustc_private` unstable (default: no)"),
17291743
fuel: Option<(String, u64)> = (None, parse_optimization_fuel, [TRACKED],

compiler/rustc_span/src/symbol.rs

+5
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ symbols! {
536536
cfg_attr_multi,
537537
cfg_doctest,
538538
cfg_eval,
539+
cfg_fmt_debug,
539540
cfg_hide,
540541
cfg_overflow_checks,
541542
cfg_panic,
@@ -895,6 +896,7 @@ symbols! {
895896
fmaf32,
896897
fmaf64,
897898
fmt,
899+
fmt_debug,
898900
fmul_algebraic,
899901
fmul_fast,
900902
fn_align,
@@ -938,6 +940,7 @@ symbols! {
938940
fs_create_dir,
939941
fsub_algebraic,
940942
fsub_fast,
943+
full,
941944
fundamental,
942945
fused_iterator,
943946
future,
@@ -1281,6 +1284,7 @@ symbols! {
12811284
new_binary,
12821285
new_const,
12831286
new_debug,
1287+
new_debug_noop,
12841288
new_display,
12851289
new_lower_exp,
12861290
new_lower_hex,
@@ -1715,6 +1719,7 @@ symbols! {
17151719
semitransparent,
17161720
sha512_sm_x86,
17171721
shadow_call_stack,
1722+
shallow,
17181723
shl,
17191724
shl_assign,
17201725
shorter_tail_lifetimes,

library/core/src/fmt/rt.rs

+4
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ impl<'a> Argument<'a> {
118118
Self::new(x, Debug::fmt)
119119
}
120120
#[inline(always)]
121+
pub fn new_debug_noop<'b, T: Debug>(x: &'b T) -> Argument<'_> {
122+
Self::new(x, |_, _| Ok(()))
123+
}
124+
#[inline(always)]
121125
pub fn new_octal<'b, T: Octal>(x: &'b T) -> Argument<'_> {
122126
Self::new(x, Octal::fmt)
123127
}

src/doc/rustc/src/check-cfg.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,15 @@ the need to specify them manually.
9999
Well known names and values are implicitly added as long as at least one `--check-cfg` argument
100100
is present.
101101
102-
As of `2024-05-06T`, the list of known names is as follows:
102+
As of `2024-08-20T`, the list of known names is as follows:
103103
104104
<!--- See CheckCfg::fill_well_known in compiler/rustc_session/src/config.rs -->
105105
106106
- `clippy`
107107
- `debug_assertions`
108108
- `doc`
109109
- `doctest`
110+
- `fmt_debug`
110111
- `miri`
111112
- `overflow_checks`
112113
- `panic`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# `fmt-debug`
2+
3+
The tracking issue for this feature is: [#129709](https://github.com/rust-lang/rust/issues/129709).
4+
5+
------------------------
6+
7+
Option `-Z fmt-debug=val` controls verbosity of derived `Debug` implementations
8+
and debug formatting in format strings (`{:?}`).
9+
10+
* `full``#[derive(Debug)]` prints types recursively. This is the default behavior.
11+
12+
* `shallow``#[derive(Debug)]` prints only the type name, or name of a variant of a fieldless enums. Details of the `Debug` implementation are not stable and may change in the future. Behavior of custom `fmt::Debug` implementations is not affected.
13+
14+
* `none``#[derive(Debug)]` does not print anything at all. `{:?}` in formatting strings has no effect.
15+
This option may reduce size of binaries, and remove occurrences of type names in the binary that are not removed by striping symbols. However, it may also cause `panic!` and `assert!` messages to be incomplete.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: unexpected `--cfg fmt_debug="shallow"` flag
2+
|
3+
= note: config `fmt_debug` is only supposed to be controlled by `-Z fmt-debug`
4+
= note: manually setting a built-in cfg can and does create incoherent behaviors
5+
= note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default
6+
7+
error: aborting due to 1 previous error
8+

tests/ui/cfg/disallowed-cli-cfgs.rs

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//@ revisions: target_pointer_width_ target_vendor_ target_has_atomic_
77
//@ revisions: target_has_atomic_equal_alignment_ target_has_atomic_load_store_
88
//@ revisions: target_thread_local_ relocation_model_
9+
//@ revisions: fmt_debug_
910

1011
//@ [overflow_checks_]compile-flags: --cfg overflow_checks
1112
//@ [debug_assertions_]compile-flags: --cfg debug_assertions
@@ -31,5 +32,6 @@
3132
//@ [target_has_atomic_load_store_]compile-flags: --cfg target_has_atomic_load_store="32"
3233
//@ [target_thread_local_]compile-flags: --cfg target_thread_local
3334
//@ [relocation_model_]compile-flags: --cfg relocation_model="a"
35+
//@ [fmt_debug_]compile-flags: --cfg fmt_debug="shallow"
3436

3537
fn main() {}

tests/ui/check-cfg/allow-same-level.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `FALSE`
44
LL | #[cfg(FALSE)]
55
| ^^^^^
66
|
7-
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
7+
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
88
= help: to expect this configuration use `--check-cfg=cfg(FALSE)`
99
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
1010
= note: `#[warn(unexpected_cfgs)]` on by default

tests/ui/check-cfg/cargo-build-script.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `has_foo`
44
LL | #[cfg(has_foo)]
55
| ^^^^^^^
66
|
7-
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `has_bar`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
7+
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `has_bar`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
88
= help: consider using a Cargo feature instead
99
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
1010
[lints.rust]

tests/ui/check-cfg/cargo-feature.none.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable`
2525
LL | #[cfg(tokio_unstable)]
2626
| ^^^^^^^^^^^^^^
2727
|
28-
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
28+
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
2929
= help: consider using a Cargo feature instead
3030
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
3131
[lints.rust]

0 commit comments

Comments
 (0)