gdesmott / system-deps

Run pkg-config from declarative dependencies in Cargo.toml
Apache License 2.0
87 stars 21 forks source link

Does rust nightly require the lints.rust exceptions for system-deps dependencies? #98

Open federicomenaquintero opened 2 months ago

federicomenaquintero commented 2 months ago

On rust nightly, librsvg is getting a lot of these:

error: unexpected `cfg` condition name: `system_deps_have_fontconfig`
   --> rsvg/src/test_utils/mod.rs:124:9
    |
124 |     not(system_deps_have_fontconfig),
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = 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(system_deps_have_fontconfig)'] }

And sure enough, per the help message and this note about automatic checking of cfgs, things work fine when I add those chunks to Cargo.toml.

That page also suggests printing some magic info from build.rs as an alternative (search for "build.rs example" in it). Is this something that system-deps could do itself?

gdesmott commented 2 months ago

Interesting.

If it's as simple as printing those "cargo::rustc-check-cfg=cfg(has_foo)" then sure, system-deps could easily do that.

federicomenaquintero commented 2 months ago

I haven't tried doing it from build.rs, as it seemed more convenient to just copy the compiler's suggestion into Cargo.toml.