## Crater report analysis *Context: The crater run enable-by-default cargo `-Zcheck-cfg` and temporarily put the `unexpected_cfgs` lint to deny-by-default, and here are the results.* Affected projects: 6708 / 414692 (1.62%) Total (raw) errors: 200499 ### 50 most seen unexpected cfg errors Summary: no false-positives[^false_positives], see the others section for more details. <details> well, ignoring `docsrs` (already fixed), `rustfmt` (deprecated/no longer in use) as well as `feature="cargo-clippy"` (and `feature="clippy"`)" which are deprecated and should be in the `[features]` table. | name | value | comment | |------|-------|---------| | `docsrs` | `None` | 24472 errors in 1994 projects | | `rustfmt` | `None` | 11084 errors in 818 projects | | `feature` | `"cargo-clippy"` | 8038 errors in 531 projects | | `feature` | `"dim3"` | 6714 errors in 14 projects | | `tarpaulin_include` | `None` | 4938 errors in 212 projects | | `feature` | `"serde"` | 4006 errors in 88 projects | | `doc_cfg` | `None` | 3807 errors in 130 projects | | `feature` | `"dim2"` | 3796 errors in 13 projects | | `target_os` | `"solana"` | 3520 errors in 23 projects | | `tarpaulin` | `None` | 3052 errors in 97 projects | | `num` | `None` | 2842 errors in 2 projects | | `loom` | `None` | 2700 errors in 78 projects | | `enable_x86_avx2` | `None` | 2556 errors in 8 projects | | `fuzzing` | `None` | 2410 errors in 103 projects | | `nightly` | `None` | 2402 errors in 157 projects | | `feature` | `"tracing"` | 2035 errors in 10 projects | | `feature` | `"std"` | 1948 errors in 138 projects | | `feature` | `"library"` | 1910 errors in 72 projects | | `ossl110` | `None` | 1820 errors in 4 projects | | `feature` | `"inline"` | 1786 errors in 2 projects | | `feature` | `"inline_always"` | 1781 errors in 2 projects | | `cpp_lib_version` | `"5.14.0"` | 1746 errors in 3 projects | | `feature` | `"dox"` | 1701 errors in 5 projects | | `cpp_lib_version` | `"5.13.0"` | 1667 errors in 3 projects | | `PyPy` | `None` | 1649 errors in 5 projects | | `riscv` | `None` | 1634 errors in 5 projects | | `cpp_lib_version` | `"5.12.2"` | 1492 errors in 3 projects | | `feature` | `"clippy"` | 1444 errors in 92 projects | | `docs_rs` | `None` | 1364 errors in 31 projects | | `track_caller` | `None` | 1314 errors in 4 projects | | `feature` | `"inline-more"` | 1244 errors in 6 projects | | `Py_LIMITED_API` | `None` | 1200 errors in 6 projects | | `feature` | `"last_seen_epoch"` | 1008 errors in 252 projects | | `feature` | `"last_seen_iso_8601"` | 1008 errors in 252 projects | | `cpp_lib_version` | `"5.11.3"` | 988 errors in 3 projects | | `riscv32` | `None` | 983 errors in 2 projects | | `feature` | `"sqlx"` | 982 errors in 4 projects | | `target_arch` | `"spirv"` | 952 errors in 11 projects | | `feature` | `"arbitrary_precision"` | 924 errors in 4 projects | | `ossl300` | `None` | 845 errors in 4 projects | | `RUSTC_WITH_SPECIALIZATION` | `None` | 796 errors in 36 projects | | `has_i128` | `None` | 788 errors in 14 projects | | `feature` | `"unstable"` | 786 errors in 32 projects | | `feature` | `"nightly"` | 752 errors in 92 projects | | `feature` | `"conversion"` | 736 errors in 2 projects | | `no_global_oom_handling` | `None` | 730 errors in 18 projects | | `test_utilities` | `None` | 700 errors in 23 projects | | `target_pointer_width` | `"128"` | 690 errors in 43 projects | | `x11_platform` | `None` | 690 errors in 7 projects | | `trybuild` | `None` | 674 errors in 2 projects | </details> ### 50 most seen unexpected `feature` cfg Summary: no false-positives, all of them are missing from the `[features]` table. <details> | name | value | comment | |------|-------|---------| | `feature` | `"cargo-clippy"` | 8038 errors in 531 projects | | `feature` | `"dim3"` | 6714 errors in 14 projects | | `feature` | `"serde"` | 4006 errors in 88 projects | | `feature` | `"dim2"` | 3796 errors in 13 projects | | `feature` | `"tracing"` | 2035 errors in 10 projects | | `feature` | `"std"` | 1948 errors in 138 projects | | `feature` | `"library"` | 1910 errors in 72 projects | | `feature` | `"inline"` | 1786 errors in 2 projects | | `feature` | `"inline_always"` | 1781 errors in 2 projects | | `feature` | `"dox"` | 1701 errors in 5 projects | | `feature` | `"clippy"` | 1444 errors in 92 projects | | `feature` | `"inline-more"` | 1244 errors in 6 projects | | `feature` | `"last_seen_epoch"` | 1008 errors in 252 projects | | `feature` | `"last_seen_iso_8601"` | 1008 errors in 252 projects | | `feature` | `"sqlx"` | 982 errors in 4 projects | | `feature` | `"arbitrary_precision"` | 924 errors in 4 projects | | `feature` | `"unstable"` | 786 errors in 32 projects | | `feature` | `"nightly"` | 752 errors in 92 projects | | `feature` | `"conversion"` | 736 errors in 2 projects | | `feature` | `"simd"` | 654 errors in 9 projects | | `feature` | `"dist_mode"` | 584 errors in 4 projects | | `feature` | `"cons_mode"` | 460 errors in 3 projects | | `feature` | `"json"` | 426 errors in 73 projects | | `feature` | `"grpc"` | 392 errors in 4 projects | | `feature` | `"dashu-int-TODO"` | 390 errors in 1 projects | | `feature` | `"1.10.0"` | 372 errors in 2 projects | | `feature` | `"1.12.0"` | 370 errors in 2 projects | | `feature` | `"nalgebra"` | 368 errors in 2 projects | | `feature` | `"test"` | 352 errors in 21 projects | | `feature` | `"ffmpeg_5_0"` | 332 errors in 1 projects | | `feature` | `"enable-tracing"` | 328 errors in 1 projects | | `feature` | `"ffmpeg_4_3"` | 321 errors in 1 projects | | `feature` | `"raw_value"` | 312 errors in 2 projects | | `feature` | `"debug"` | 294 errors in 11 projects | | `feature` | `"cgmath"` | 240 errors in 2 projects | | `feature` | `"metrics"` | 220 errors in 6 projects | | `feature` | `"mdns"` | 208 errors in 2 projects | | `feature` | `"branch_mode"` | 200 errors in 3 projects | | `feature` | `"branch_wasm_mode"` | 192 errors in 3 projects | | `feature` | `"ffmpeg_4_2"` | 192 errors in 1 projects | | `feature` | `"ffmpeg_4_4"` | 192 errors in 1 projects | | `feature` | `"dev"` | 184 errors in 15 projects | | `feature` | `"wee_alloc"` | 176 errors in 47 projects | | `feature` | `"serde-feature"` | 172 errors in 5 projects | | `feature` | `"ffmpeg_4_1"` | 172 errors in 1 projects | | `feature` | `"critical-section"` | 170 errors in 43 projects | | `feature` | `"serialize"` | 170 errors in 9 projects | | `feature` | `"failpoints"` | 164 errors in 3 projects | | `feature` | `"persistence"` | 164 errors in 15 projects | | `feature` | `"jack"` | 154 errors in 12 projects | </details> ### 50 most seen unexpected `target_*` cfg Summary: Many typos (`target_os="unix"`, `target_arch="i686"`, ...), some reference to removed targets (`target_os="cloudabi"`, `target_arch="asmjs"`, ...), as well as some custom cfg (`target_os="solana"`, ...). <details> | name | value | comment | |------|-------|---------| | `target_os` | `"solana"` | 3520 errors in 23 projects | | `target_arch` | `"spirv"` | 952 errors in 11 projects | | `target_pointer_width` | `"128"` | 690 errors in 43 projects | | `target_arch` | `"nvptx"` | 630 errors in 10 projects | | `target_pointer_width` | `"8"` | 427 errors in 38 projects | | `target_os` | `"bitrig"` | 384 errors in 58 projects | | `target_os` | `"dos"` | 368 errors in 7 projects | | `target_os` | `"unix"` | 166 errors in 22 projects | | `target_arch` | `"i686"` | 140 errors in 14 projects | | `target_arch` | `"mips64el"` | 114 errors in 4 projects | | `target_os` | `"nacl"` | 86 errors in 14 projects | | `target_env` | `"wasi"` | 84 errors in 8 projects | | `target_arch` | `"asmjs"` | 82 errors in 14 projects | | `target_os` | `"darwin"` | 48 errors in 13 projects | | `target_feature` | `"1_30"` | 48 errors in 1 projects | | `target_feature` | `"session"` | 44 errors in 1 projects | | `target_arch` | `"wasm"` | 44 errors in 5 projects | | `target_os` | `"wasm"` | 44 errors in 4 projects | | `target_os` | `"dragonflybsd"` | 40 errors in 7 projects | | `target_arch` | `"riscv"` | 34 errors in 7 projects | | `target_arch` | `"armv7"` | 34 errors in 9 projects | | `target_arch` | `"mipsel"` | 34 errors in 9 projects | | `target_arch` | `"s390"` | 30 errors in 1 projects | | `target_arch` | `"aarch"` | 28 errors in 5 projects | | `target_os` | `"androideabi"` | 28 errors in 1 projects | | `target_os` | `"cloudabi"` | 26 errors in 5 projects | | `target_env` | `"kernel"` | 26 errors in 2 projects | | `target_arch` | `"alpha"` | 24 errors in 2 projects | | `target_arch` | `"parisc"` | 24 errors in 2 projects | | `target_arch` | `"arm64"` | 24 errors in 2 projects | | `target_feature` | `"iter_advance_by"` | 24 errors in 3 projects | | `target_feature` | `"crypto"` | 20 errors in 3 projects | | `target_os` | `"cbe"` | 20 errors in 1 projects | | `target_arch` | `"x64_64"` | 20 errors in 3 projects | | `target_os` | `"switch"` | 18 errors in 3 projects | | `target_os` | `"window"` | 18 errors in 5 projects | | `target_arch` | `"parisc2.0"` | 16 errors in 1 projects | | `target_arch_char_unsigned` | `None` | 16 errors in 1 projects | | `target_arch` | `"i386"` | 16 errors in 3 projects | | `target_device` | `"esp8266"` | 16 errors in 1 projects | | `target_is` | `"macos"` | 16 errors in 2 projects | | `target_feature` | `"exact_size_is_empty"` | 16 errors in 3 projects | | `target_arch` | `"x64"` | 16 errors in 2 projects | | `target_os` | `"solarish"` | 16 errors in 1 projects | | `target_arch` | `"amd64"` | 16 errors in 1 projects | | `target_arch` | `"mos"` | 16 errors in 1 projects | | `target_feature` | `"play-single-file"` | 16 errors in 1 projects | | `target_feature` | `"f64"` | 16 errors in 1 projects | | `target_os` | `"wasm32"` | 14 errors in 3 projects | | `target_arch` | `"xtensa"` | 14 errors in 3 projects | </details> ------ ### Summary There are four big outliers: `docsrs` (alread fixed)[^docsrs], `rustfmt` (deprecated/no longer in use) as well as `feature="cargo-clippy"` (and `feature="clippy"`) both of which are de-facto deprecated and no longer used. There is nothing do to for those. Therefore (excluding the outliers) there are 188089 unexpected cfgs, of which 69897 of the are unexpected `feature` cfgs and 11125 errors are of `target_*`. After manually checking the 3 categories above I wasn't able to find any false positive[^false_positives]; additionaly, 9649 actions would need to be taken accross 5959 projects (1.4% of all the projects tested), by either: fix the typo, removing the staled condition, marking as expected the custom cfg, adding the feature to the `features` table... All and all, while the impact is certainly not minimal, I think it is heavily mitigated by the fact that it's warn-by-default, only affects maintainers (never the downstream users) and by it's ability to warn users on unexpected cfgs, a defitiancy of the Rust toolchain, reported many times, that will final be fixed. [^docsrs]: `docsrs` shouldn't have pop-up in this crater run but I was trick by the off-by-one date of rustup and `rustc -V` :-| [^false_positives]: by "false positive" I mean: missing well known names/values