pub enum Edition {
Edition2015,
Edition2018,
Edition2021,
Edition2024,
}
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
toml
. - 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§
Edition2015
The 2015 edition
Edition2018
The 2018 edition
Edition2021
The 2021 edition
Edition2024
The 2024 edition
Implementations§
source§impl Edition
impl Edition
sourcepub const LATEST_UNSTABLE: Option<Edition> = _
pub const LATEST_UNSTABLE: Option<Edition> = _
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.
pub const ALL: &'static [Edition] = _
sourcepub const CLI_VALUES: [&'static str; 4] = _
pub const CLI_VALUES: [&'static str; 4] = _
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 PartialOrd for Edition
impl PartialOrd for Edition
impl Copy for Edition
impl Eq for Edition
impl StructuralPartialEq for Edition
Auto Trait Implementations§
impl Freeze for Edition
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§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>,
§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 bytesEdition2024
: 0 bytes