Enum cargo::core::features::Edition

source ·
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 to true.
  • 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

Implementations§

The latest edition that is unstable.

This is None if there is no next unstable edition.

The latest stable edition.

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.

Returns the first version that a particular edition was released on stable.

Returns true if this edition is stable in this release.

Returns the previous edition from this edition.

Returns None for 2015.

Returns the next edition from this edition, returning the last edition if this is already the last one.

Updates the given ProcessBuilder to include the appropriate flags for setting the edition.

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?

Whether or not this edition supports the rust_*_idioms lint.

Ideally this would not be necessary…

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Formats the value using the given formatter. Read more
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

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 bytes
  • Edition2018: 0 bytes
  • Edition2021: 0 bytes