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(crate) fn first_version(&self) -> Option<Version>
pub(crate) fn first_version(&self) -> Option<Version>
Returns the first version that a particular edition was released on stable.
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.
sourcepub(crate) fn cmd_edition_arg(&self, cmd: &mut ProcessBuilder)
pub(crate) fn cmd_edition_arg(&self, cmd: &mut ProcessBuilder)
Updates the given ProcessBuilder
to include the appropriate flags
for setting the edition.
sourcepub(crate) fn supports_compat_lint(&self) -> bool
pub(crate) fn supports_compat_lint(&self) -> bool
Whether or not this edition supports the rust_*_compatibility
lint.
Ideally this would not be necessary, but editions may not have any
lints, and thus rustc
doesn’t recognize it. Perhaps rustc
could
create an empty group instead?
sourcepub(crate) fn supports_idiom_lint(&self) -> bool
pub(crate) fn supports_idiom_lint(&self) -> bool
Whether or not this edition supports the rust_*_idioms
lint.
Ideally this would not be necessary…
pub(crate) fn default_resolve_behavior(&self) -> ResolveBehavior
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>,
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
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
§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
§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
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Serialize for Twhere
T: Serialize + ?Sized,
impl<T> Serialize for Twhere T: Serialize + ?Sized,
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte
Size for each variant:
Edition2015
: 0 bytesEdition2018
: 0 bytesEdition2021
: 0 bytes