Crates should consider supporting no_std if reasonable #189
Replies: 4 comments
-
What's a good (nice and simple) example of doing this right? |
Beta Was this translation helpful? Give feedback.
-
(Also default-features = false is related to rust-lang/cargo#3126) |
Beta Was this translation helpful? Give feedback.
-
@dwijnand The regex crate does this, without actually supporting The features are defined here: https://github.com/rust-lang/regex/blob/60d087a23025e045ae754a345b04003c31d83d93/Cargo.toml#L47-L54 And a convenient compilation error is defined here: https://github.com/rust-lang/regex/blob/60d087a23025e045ae754a345b04003c31d83d93/src/lib.rs#L524-L525 Note that you should use |
Beta Was this translation helpful? Give feedback.
-
One possible gotcha when adding conditional I think that's just an example of a broader recommendation that Cargo features should not change the public API in breaking ways, but since |
Beta Was this translation helpful? Give feedback.
-
Crates that have signatures and/or trait impls for std types cannot backwards-compatibly add a
std
feature (because downstream crates may be usingdefault-features = false
). Therefore, this is something a crate should add before 1.0, not after.Beta Was this translation helpful? Give feedback.
All reactions