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
When consuming this crate from Rust 2024 edition code, the following warning message is generated. It's not immediately obvious what the code is trying to do (#[cfg(trybuild)]).
warning: unexpected `cfg` condition name: `trybuild`
--> simple/src/main.rs:6:5
|
6 | / #[message_bundle(7 | | resources = [8 | | ("l10n/en-US/messages.ftl","en-US"),9 | | ("l10n/fr-CH/messages.ftl","fr-CH"),10 | | ],11 | | default_language = "en-US")]
| |____________________________________^
|
= 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 attribute macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `message_bundle` crate for guidance on how handle this unexpected cfg
= help: the attribute macro `message_bundle` may come from an old version of the `fluent_static_macros` crate, try updating your dependency with `cargo update -p fluent_static_macros`
= 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 attribute macro `message_bundle` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: `procmacro` (bin "procmacro") generated 1 warning
Reproducing
Reproduction of warning is fairly easy:
Modify the simple example to use the 2024 edition by changing examples/simple/Cargo.toml:4 from 2021 to 2024 edition:
is basically a hack/workaround to make cargo build aware of changes in external file.
And until rust-lang/rust#99515 stabilized I don't see other options to implement this.
AFAIK #[cfg(trybuild)] is the only way to detect that code is running inside of test env created by trybuild
I'll take a look into this sometime next week, but for now I'd suggest to disable warning with
When consuming this crate from Rust 2024 edition code, the following warning message is generated. It's not immediately obvious what the code is trying to do (
#[cfg(trybuild)]
).Reproducing
Reproduction of warning is fairly easy:
simple
example to use the 2024 edition by changing examples/simple/Cargo.toml:4 from 2021 to 2024 edition:Origin code
crates/macros/src/lib.rs:36-41
Compiled using
The text was updated successfully, but these errors were encountered: