serenity-rs / serenity

A Rust library for the Discord API.
https://discord.gg/serenity-rs
ISC License
4.67k stars 572 forks source link

Feature not properly Guarded #2863

Open MTaliancich opened 3 months ago

MTaliancich commented 3 months ago

The following line causes a compile failure with the Client and (native_tls_backend or rustls_backend) options selected:

https://github.com/serenity-rs/serenity/blob/398d406a268e7ffe622b0427af8cc7a5d99b7372/src/client/context.rs#L9

Cargo.toml snippit: serenity = { version = "0.12", default-features = false, features = ["client", "rustls_backend"] }

The line below it has a guard for the import: https://github.com/serenity-rs/serenity/blob/398d406a268e7ffe622b0427af8cc7a5d99b7372/src/client/context.rs#L10

This is just one example, I have now found several areas that cause issues when compiling due to an unguarded area of code. Perhaps it is intended that enabling the feature was supposed to toggle these other features as-well but was forgotten.

GnomedDev commented 3 months ago

Overall the serenity feature situation is a mess, we will accept PRs to current to fix it but I'm planning on removing a lot of feature guards in 0.13 so it becomes feasible to run cargo hack --feature-superset check to check all feature combinations compile.