coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.36k stars 1.25k forks source link

idl: Fix `unexpected_cfgs` build warning #2992

Closed acheroncrypto closed 1 month ago

acheroncrypto commented 1 month ago

Problem

There is a new #[cfg] related lint with Rust 1.80 (nightly-2024-05-05):

warning: unexpected `cfg` condition name: `procmacro2_semver_exempt`
   --> ~/anchor/lang/syn/src/idl/defined.rs:493:19
    |
493 |             #[cfg(procmacro2_semver_exempt)]
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `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`, `windows`
    = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(procmacro2_semver_exempt)");` to the top of the `build.rs`
    = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
    = note: `#[warn(unexpected_cfgs)]` on by default

See https://blog.rust-lang.org/2024/05/06/check-cfg.html

Summary of changes

Allow #[cfg(procmacro2_semver_exempt)] in Cargo.toml's [lints.rust.unexpected_cfgs] section. This #[cfg] is necessary for resolving external types with the help of proc-macro2 crate.

vercel[bot] commented 1 month ago

@acheroncrypto is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.