Warning regarding unexpected `cfg` condition names
~~This issue only appears on nightly, so this is more of a warning what might come in the future instead of an actual bug report.~~ I hope it can still be of use to you :).
Rust version
- rustc 1.86.0-nightly (b3b368a18 2025-01-05)
- rustc 1.84.0-stable
Description
When compiling crates using v_escape the compiler throws various warnings regarding unexpected cfg condition names.
For reference I've created the following repository: https://github.com/liss-h/v_escape_warning_bug
When I compile it (with cargo build) I get the following warnings.
warning: unexpected `cfg` condition name: `v_escape_nosimd`
--> src/main.rs:2:1
|
2 | v_escape::new!(TsvEscape; '\t' -> "\\t", '\r' -> "\\r", '\n' -> "\\n", '\\' -> "\\\\");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `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`
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `$crate::derive` crate for guidance on how handle this unexpected cfg
= help: the macro `$crate::derive` may come from an old version of the `v_escape_derive` crate, try updating your dependency with `cargo update -p v_escape_derive`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
= note: this warning originates in the macro `$crate::derive` which comes from the expansion of the macro `v_escape::new` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition name: `b_escape_nosimd`
--> src/main.rs:2:1
|
2 | v_escape::new!(TsvEscape; '\t' -> "\\t", '\r' -> "\\r", '\n' -> "\\n", '\\' -> "\\\\");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `v_escape::cfg_escape_bytes` crate for guidance on how handle this unexpected cfg
= help: the macro `v_escape::cfg_escape_bytes` may come from an old version of the `v_escape` crate, try updating your dependency with `cargo update -p v_escape`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the macro `v_escape::cfg_escape_bytes` which comes from the expansion of the macro `v_escape::new` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition name: `v_escape_avx`
--> src/main.rs:2:1
|
2 | v_escape::new!(TsvEscape; '\t' -> "\\t", '\r' -> "\\r", '\n' -> "\\n", '\\' -> "\\\\");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `$crate::cfg_escape_bytes` crate for guidance on how handle this unexpected cfg
= help: the macro `$crate::cfg_escape_bytes` may come from an old version of the `v_escape` crate, try updating your dependency with `cargo update -p v_escape`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the macro `$crate::cfg_escape_bytes` which comes from the expansion of the macro `v_escape::new` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition name: `v_escape_sse`
--> src/main.rs:2:1
|
2 | v_escape::new!(TsvEscape; '\t' -> "\\t", '\r' -> "\\r", '\n' -> "\\n", '\\' -> "\\\\");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `$crate::cfg_escape_bytes` crate for guidance on how handle this unexpected cfg
= help: the macro `$crate::cfg_escape_bytes` may come from an old version of the `v_escape` crate, try updating your dependency with `cargo update -p v_escape`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the macro `$crate::cfg_escape_bytes` which comes from the expansion of the macro `v_escape::new` (in Nightly builds, run with -Z macro-backtrace for more info)
Thanks for report! These cfg should be removed, is related to this issue https://github.com/zzau13/v_escape/issues/54. Probably I will find another method, render directly to String per example and remove support for BytesMin trait. I thought this rust issue would be resolved in less time. But it doesn't seem to be moving forward.
I think the best solution is move to bytes version Vec<u8> or String.
Update: it now also happens on stable (since 1.84)