Skip to content

Feature naming is likely to cause confusion #170

@jamesmunns

Description

We had someone in embedded trip over the fact that:

  • portable-atomic is an optional dep
  • the feature is portable_atomic
  • optional deps are allowed to have - or _ and are unified
  • If you select portable-atomic as the feature, you don't get a warning because the feature does something, but not what you expect (it still tries to use core::sync::atomic).

An example of the cfg is here: https://github.com/mvdnes/spin-rs/blob/master/src/lib.rs#L66-L67

The user had this in their Cargo.toml:

spin = { version = "0.9.8", default-features = false, features = ["portable-atomic"] }

You might want to add a "trap" for this in spin that will save someone needing to debug this in the future:

#[cfg(feature = "portable-atomic")]
compiler_error!("Oops it's a trap");

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions