Behavior not considered unsafe The Rust compiler does not consider the following behaviors unsafe, though a programmer may (should) find them undesirable, unexpected, or erroneous. • Deadlocks • Leaks of memory and other resources • Exiting...
Constant evaluation Constant evaluation is the process of computing the result of expressions during compilation. Only a subset of all expressions can be evaluated at compile-time. Constant expressions Certain forms of expressions, called c...
Application binary interface (ABI) This section documents features that affect the ABI of the compiled output of a crate. See extern functions for information on specifying the ABI for exporting functions. See external blocks for informatio...
The Rust runtime This section documents features that define some aspects of the Rust runtime. The global_allocator attribute The global_allocator [attribute][attributes] selects a [memory allocator][std::alloc]. [!EXAMPLE] use core::alloc:...
Grammar summary The following is a summary of the grammar production rules. For details on the syntax of this grammar, see [notation.grammar.syntax]. {{ grammar-summary }}
Syntax index This appendix provides an index of tokens and common forms with links to where those elements are defined. Keywords | Keyword | Use | |---------------|-----| | _ | wildcard pattern, inferred const, inferred type, placeholder li...
Appendix: Macro follow-set ambiguity formal specification This page documents the formal specification of the follow rules for Macros By Example. They were originally specified in RFC 550, from which the bulk of this text is copied, and exp...
Influences Rust is not a particularly original language, with design elements coming from a wide range of sources. Some of these are listed below (including elements that have since been removed): • SML, OCaml: algebraic data types, pattern...
Test summary The following is a summary of the total tests that are linked to individual rule identifiers within the reference. {{summary-table}}
Glossary Abstract syntax tree An ‘abstract syntax tree’, or ‘AST’, is an intermediate representation of the structure of the program when the compiler is compiling it. Alignment The alignment of a value specifies what addresses values are p...
Introduction Welcome to The Rust Edition Guide! "Editions" are Rust's way of introducing changes into the language that would not otherwise be backwards compatible. In this guide, we'll discuss: • What editions are • Which changes are conta...
What are Editions? In May 2015, the release of Rust 1.0 established "stability without stagnation" as a core Rust axiom. Since then, Rust has committed to a pivotal rule: once a feature is released through stable, contributors will continue...
Creating a new project A new project created with Cargo is configured to use the latest edition by default: $ cargo new foo Creating binary (application) `foo` package note: see more `Cargo.toml` keys and their definitions at https://doc.ru...
Transitioning an existing project to a new edition Rust includes tooling to automatically transition a project from one edition to the next. It will update your source code so that it is compatible with the next edition. Briefly, the steps...
Advanced migration strategies How migrations work cargo fix --edition works by running the equivalent of cargo check on your project with special lints enabled which will detect code that may not compile in the next edition. These lints inc...
Rust 2015 Rust 2015 has a theme of "stability". It commenced with the release of 1.0, and is the "default edition". The edition system was conceived in late 2017, but Rust 1.0 was released in May of 2015. As such, 2015 is the edition that y...
Rust 2018 | Info | | | --- | --- | | RFC | #2052, which also proposed the Edition system | | Release version | 1.31.0 | The edition system was created for the release of Rust 2018. The release of the Rust 2018 edition coincided with a numbe...
Path and module system changes Minimum Rust version: 1.31 Summary • Paths in use declarations now work the same as other paths. • Paths starting with :: must now be followed with an external crate. • Paths in pub(in path) visibility modifie...
Anonymous trait function parameters deprecated Minimum Rust version: 1.31 Summary • Trait function parameters may use any irrefutable pattern when the function has a body. Details In accordance with RFC #1685, parameters in trait method dec...