pub enum Edition {
Edition2015,
Edition2018,
Edition2021,
}
Expand description
The edition of the compiler (RFC 2052)
The following sections will guide you how to add and stabilize an edition.
Adding a new edition
- Add the next edition to the enum.
- Update every match expression that now fails to compile.
- Update the
FromStr
impl. - Update
CLI_VALUES
to include the new edition. - Set
LATEST_UNSTABLE
to Some with the new edition. - Add an unstable feature to the
features!
macro invocation below for the new edition. - Gate on that new feature in
TomlManifest::to_real_manifest
. - Update the shell completion files.
- Update any failing tests (hopefully there are very few).
- Update unstable.md to add a new section for this new edition (see this example).
Stabilization instructions
- Set
LATEST_UNSTABLE
to None. - Set
LATEST_STABLE
to the new version. - Update
is_stable
totrue
. - Set the editionNNNN feature to stable in the
features!
macro invocation below. - Update any tests that are affected.
- Update the man page for the
--edition
flag. - Update unstable.md to move the edition section to the bottom.
- Update the documentation:
- Update any features impacted by the edition.
- Update manifest.md#the-edition-field.
- Update the
--edition
flag (options-new.md). - Rebuild man pages.
Variants§
Implementations§
source§impl Edition
impl Edition
sourcepub const LATEST_UNSTABLE: Option<Edition> = None
pub const LATEST_UNSTABLE: Option<Edition> = None
The latest edition that is unstable.
This is None
if there is no next unstable edition.
sourcepub const LATEST_STABLE: Edition = Edition::Edition2021
pub const LATEST_STABLE: Edition = Edition::Edition2021
The latest stable edition.
sourcepub const CLI_VALUES: [&'static str; 3] = _
pub const CLI_VALUES: [&'static str; 3] = _
Possible values allowed for the --edition
CLI flag.
This requires a static value due to the way clap works, otherwise I would have built this dynamically.
sourcepub fn previous(&self) -> Option<Edition>
pub fn previous(&self) -> Option<Edition>
Returns the previous edition from this edition.
Returns None
for 2015.
sourcepub fn saturating_next(&self) -> Edition
pub fn saturating_next(&self) -> Edition
Returns the next edition from this edition, returning the last edition if this is already the last one.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Edition
impl<'de> Deserialize<'de> for Edition
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Edition
impl Ord for Edition
source§impl PartialEq<Edition> for Edition
impl PartialEq<Edition> for Edition
source§impl PartialOrd<Edition> for Edition
impl PartialOrd<Edition> for Edition
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Edition
impl Eq for Edition
impl StructuralEq for Edition
impl StructuralPartialEq for Edition
Auto Trait Implementations§
impl RefUnwindSafe for Edition
impl Send for Edition
impl Sync for Edition
impl Unpin for Edition
impl UnwindSafe for Edition
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more