Skip to content

Commit 3d5dd47

Browse files
committed
warn against automatically using nightly features
1 parent 736b788 commit 3d5dd47

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/lib.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@
5757
//! }
5858
//! ```
5959
//!
60+
//! Note that it is generally a bad idea to automatically use a feature just
61+
//! because it is supported. Nightly features are unstable by their very nature,
62+
//! so a crate that automatically makes use of nightly features is prone to
63+
//! breakage: if the feature changes in rustc in an incompatible way, then a
64+
//! crate that automatically uses the feature will fail to build for everyone
65+
//! using nightly! The recommended practice is to make using nightly features
66+
//! opt-in (e.g. via a crate feature), so that people only experience broken
67+
//! builds when they explicitly asked for a nightly feature.
68+
//!
6069
//! * Check that the running compiler is on the stable channel:
6170
//!
6271
//! ```rust
@@ -277,6 +286,15 @@ pub fn is_feature_flaggable() -> Option<bool> {
277286
/// `CARGO_ENCODED_RUSTFLAGS`. If the version could not be determined, returns
278287
/// `None`.
279288
///
289+
/// Note that it is generally a bad idea to automatically use a feature just
290+
/// because it is supported. Nightly features are unstable by their very nature,
291+
/// so a crate that automatically makes use of nightly features is prone to
292+
/// breakage: if the feature changes in rustc in an incompatible way, then a
293+
/// crate that automatically uses the feature will fail to build for everyone
294+
/// using nightly! The recommended practice is to make using nightly features
295+
/// opt-in (e.g. via a crate feature), so that people only experience broken
296+
/// builds when they explicitly asked for a nightly feature.
297+
///
280298
/// # Example
281299
///
282300
/// ```rust

0 commit comments

Comments
 (0)