oxidecomputer / usdt

Dust your Rust with USDT probes
Apache License 2.0
82 stars 10 forks source link

Remove public feature flags #57

Open bnaecker opened 2 years ago

bnaecker commented 2 years ago

The current implementation of usdt (v0.3.2) uses the public feature flag "asm" to decide what code to generate inside the probe macros. We initially did this for a few reasons. First, the Rust asm feature was required, and it's pretty common practice to gate nightly features in a crate with a public feature flag. Secondly, it was very useful for development to pick a real or no-op implementation of the probes.

The time has come to remove this feature flag, however. The asm feature has been stabilized. The asm_sym feature, required for macOS, is on the path to stabilization. More importantly, a feature flag for this doesn't make a whole lot of sense. First, the "real" version of the probes is the whole point of the crate, so turning them off seems silly. Second, feature flags are additive, which I didn't quite appreciate when I built it this way initially. This is a big problem, since it means it's possible for trouble when crate uses two other crates, both of which use usdt. If one enables the probes, it doesn't matter whether the other crate chose to enable them, the probes are there due to feature unification.

This issue tracks removing all public feature flags. The crate will choose the code to be generated in the probe macros solely on the basis of the target OS.

bnaecker commented 8 months ago

It may be a good time to tackle this. The last feature we really need, asm_sym, stabilized some time ago. If we're willing to push the MSRV to 1.66, then we can use a stable toolchain on all supported platforms and avoid any nightly messiness or feature checks. That MSRV is not too far away from the 1.65 currently implied by some of our dependencies. (E.g., see this checksuite run.)

It would be very nice to get rid of all that cruft and the attendant build.rs files. 1.66 is pretty old now, so this feels like a reasonable choice.