|
58 | 58 | //!
|
59 | 59 | //! ## `-Z` options
|
60 | 60 | //!
|
| 61 | +//! New `-Z` options cover all other functionality that isn't covered with |
| 62 | +//! `cargo-features` or `-Z unstable-options`. |
| 63 | +//! |
61 | 64 | //! The steps to add a new `-Z` option are:
|
62 | 65 | //!
|
63 | 66 | //! 1. Add the option to the [`CliUnstable`] struct below. Flags can take an
|
|
68 | 71 | //! and check if the option has been enabled on the [`CliUnstable`] instance.
|
69 | 72 | //! Nightly gating is already handled, so no need to worry about that.
|
70 | 73 | //!
|
| 74 | +//! ### `-Z` vs `cargo-features` |
| 75 | +//! |
| 76 | +//! In some cases there might be some changes that `cargo-features` is unable |
| 77 | +//! to sufficiently encompass. An example would be a syntax change in |
| 78 | +//! `Cargo.toml` that also impacts the index or resolver. The resolver doesn't |
| 79 | +//! know about `cargo-features`, so it needs a `-Z` flag to enable the |
| 80 | +//! experimental functionality. |
| 81 | +//! |
| 82 | +//! In those cases, you usually should introduce both a `-Z` flag (to enable |
| 83 | +//! the changes outside of the manifest) and a `cargo-features` entry (to |
| 84 | +//! enable the new syntax in `Cargo.toml`). The `cargo-features` entry ensures |
| 85 | +//! that any experimental syntax that gets uploaded to crates.io is clearly |
| 86 | +//! intended for nightly-only builds. Otherwise, users accessing those crates |
| 87 | +//! may get confusing errors, particularly if the syntax changes during the |
| 88 | +//! development cycle, and the user tries to access it with a stable release. |
| 89 | +//! |
| 90 | +//! ### `-Z` with external files |
| 91 | +//! |
| 92 | +//! Some files, such as `config.toml` config files, or the `config.json` index |
| 93 | +//! file, are used in a global location which can make interaction with stable |
| 94 | +//! releases problematic. In general, before the feature is stabilized, stable |
| 95 | +//! Cargo should behave roughly similar to how it behaved *before* the |
| 96 | +//! unstable feature was introduced. If Cargo would normally have ignored or |
| 97 | +//! warned about the introduction of something, then it probably should |
| 98 | +//! continue to do so. |
| 99 | +//! |
| 100 | +//! For example, Cargo generally ignores (or warns) about `config.toml` |
| 101 | +//! entries it doesn't know about. This allows a limited degree of |
| 102 | +//! forwards-compatibility with future versions of Cargo that add new entries. |
| 103 | +//! |
| 104 | +//! Whether or not to warn on stable may need to be decided on a case-by-case |
| 105 | +//! basis. For example, you may want to avoid generating a warning for options |
| 106 | +//! that are not critical to Cargo's operation in order to reduce the |
| 107 | +//! annoyance of constant warnings. However, ignoring some options may prevent |
| 108 | +//! proper operation, so a warning may be valuable for a user trying to |
| 109 | +//! diagnose why it isn't working correctly. |
| 110 | +//! |
71 | 111 | //! ## Stabilization
|
72 | 112 | //!
|
73 | 113 | //! For the stabilization process, see
|
|
0 commit comments