Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning: unexpected cfg condition name: pgrx_embed #1966

Open
ccleve opened this issue Jan 12, 2025 · 0 comments
Open

warning: unexpected cfg condition name: pgrx_embed #1966

ccleve opened this issue Jan 12, 2025 · 0 comments

Comments

@ccleve
Copy link
Contributor

ccleve commented Jan 12, 2025

I just upgraded to Rust 1.84, blew away my .pgrx directory and redid cargo pgrx init, cargo clean, and then cargo pgrx run. I'm getting the error above. I have version 0.12.9 installed.

To duplicate the error, upgrade Rust as I did, run cargo pgrx new tester, switch to the tester directory, and then cargo pgrx run. I got this output:

ccleve@MacBookPro tester % cargo pgrx run
       Using DefaultFeature("pg13") and `pg_config` from /Users/ccleve/.pgrx/13.18/pgrx-install/bin/pg_config
    Building extension with features pg13
     Running command "/Users/ccleve/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo" "build" "--lib" "--features" "pg13" "--no-default-features" "--message-format=json-render-diagnostics"
   Compiling proc-macro2 v1.0.93

... bunch of files omitted ...

   Compiling pgrx v0.12.9
   Compiling tester v0.0.0 (/Users/ccleve/dev/pg/tester)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 28.90s
  Installing extension
     Copying control file to /Users/ccleve/.pgrx/13.18/pgrx-install/share/postgresql/extension/tester.control
     Copying shared library to /Users/ccleve/.pgrx/13.18/pgrx-install/lib/postgresql/tester.so
  Discovered 1 SQL entities: 0 schemas (0 unique), 1 functions, 0 types, 0 enums, 0 sqls, 0 ords, 0 hashes, 0 aggregates, 0 triggers
  Rebuilding pgrx_embed, in debug mode, for SQL generation with features pg13
   Compiling tester v0.0.0 (/Users/ccleve/dev/pg/tester)
warning: unexpected `cfg` condition name: `pgrx_embed`
 --> src/bin/pgrx_embed.rs:1:1
  |
1 | ::pgrx::pgrx_embed!();
  | ^^^^^^^^^^^^^^^^^^^^^
  |
  = 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`
  = help: consider using a Cargo feature instead
  = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
           [lints.rust]
           unexpected_cfgs = { level = "warn", check-cfg = ['cfg(pgrx_embed)'] }
  = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(pgrx_embed)");` to the top of the `build.rs`
  = 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 `::pgrx::pgrx_embed` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: unexpected `cfg` condition name: `pgrx_embed`
 --> src/bin/pgrx_embed.rs:1:1
  |
1 | ::pgrx::pgrx_embed!();
  | ^^^^^^^^^^^^^^^^^^^^^
  |
  = help: consider using a Cargo feature instead
  = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
           [lints.rust]
           unexpected_cfgs = { level = "warn", check-cfg = ['cfg(pgrx_embed)'] }
  = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(pgrx_embed)");` to the top of the `build.rs`
  = 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 `::pgrx::pgrx_embed` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: `tester` (bin "pgrx_embed_tester") generated 2 warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.35s
     Writing SQL entities to /Users/ccleve/.pgrx/13.18/pgrx-install/share/postgresql/extension/tester--0.0.0.sql
    Finished installing tester
    Starting Postgres v13 on port 28813
     Creating database tester
psql (13.18)
Type "help" for help.

tester=# 

I took the compiler's suggestion to add the println!() line to build.rs and the problem went away.

I'm wondering if Rust changed something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant