Envoyé par
23JFK
Désolé, mais dans le code d'en haut, from_bits() semble tagué unstable.
En complément de la réponse de Pyramidev:
https://doc.rust-lang.org/book/appen...htly-rust.html
Unstable Features
There’s one more catch with this release model: unstable features. Rust uses a technique called “feature flags” to determine what features are enabled in a given release. If a new feature is under active development, it lands on master, and therefore, in nightly, but behind a feature flag. If you, as a user, wish to try out the work-in-progress feature, you can, but you must be using a nightly release of Rust and annotate your source code with the appropriate flag to opt in.
If you’re using a beta or stable release of Rust, you can’t use any feature flags. This is the key that allows us to get practical use with new features before we declare them stable forever. Those who wish to opt into the bleeding edge can do so, and those who want a rock-solid experience can stick with stable and know that their code won’t break. Stability without stagnation.
This book only contains information about stable features, as in-progress features are still changing, and surely they’ll be different between when this book was written and when they get enabled in stable builds. You can find documentation for nightly-only features online.
Autrement dit, il n'est pas possible d'utiliser des composants nightly dans une configuration stable de Rust. Le fait que le playground soit exécuté en mode stable impose donc que tout le code utilisé soit stable.
Il existe des moyens de contourner cette règle, mais un tel crime est tout à fait déconseillé :
https://crates.io/crates/nightly-crimes
J'ai testé cette macro de Mara Bos et elle semble toujours fonctionner (mais pas son exemple, puisque la syntaxe expérimentale box value a été abandonnée).
Partager