Skip to content

Commit bec97e3

Browse files
committed
💡 Add Rust 2024
1 parent f952664 commit bec97e3

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

‎content/en/docs/a4.cargo-crates-and-basic-project-structure.md

+16-6
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ Cargo is Rust’s built-in package manager and build system. It also supports th
1515
| `cargo build` | Build the executable |
1616
| `cargo run` | Build the executable and run |
1717

18-
> 💡 The `cargo check` command verifies that the project compiles without errors, without producing an executable.
18+
> 💡 The `cargo check` command verifies that the project compiles without errors, without producing an executable.
1919
> Thus, it is often faster than `cargo build`.
2020
21-
> 💡 Cargo places executables compiled with `cargo build` or `cargo run` in the `target/debug/` directory.
22-
> But, while those built with **`cargo build --release`** for release purposes are stored in `target/release/` directory.
21+
> 💡 Cargo places executables compiled with `cargo build` or `cargo run` in the `target/debug/` directory.
22+
> But, while those built with **`cargo build --release`** for release purposes are stored in `target/release/` directory.
2323
> Release builds use more optimizations and remove some runtime safety checks to increase performance, although this comes at the cost of longer compile time.
2424
2525
| Command | Action |
@@ -55,7 +55,7 @@ In addition, there are `cargo` commands to publish the project as a crate to [cr
5555
5656
## Crate
5757

58-
- A crate is a package, which can be shared via Rust community’s crate registry, [crates.io](https://crates.io/).
58+
- A crate is a package, which can be shared via Rust community’s crate registry, [crates.io](https://crates.io/).
5959

6060
- A crate can produce an executable or a library. In other words, it can be a **binary** crate or a **library** crate.
6161
1. `cargo new crate_name --bin` or `cargo new crate_name`: Produces an executable
@@ -117,7 +117,17 @@ This is how [Cargo documentation describes](https://doc.rust-lang.org/cargo/guid
117117

118118
## Rust Editions
119119

120-
Rust guarantees backward compatibility while introducing major updates to the language. To support this, the `edition` field was added to the `Cargo.toml` file in Rust 2018, marking the first major update to the language ecosystem three years after its initial release. Editions are opt-in, meaning existing crates will not experience these changes until they explicitly migrate to the new edition.Rust guarantees backward compatibility between editions, allowing crates using older editions of Rust to interoperate seamlessly with those using newer versions.
120+
Rust guarantees backward compatibility while introducing major updates to the language. To support this, the `edition` field was added to the `Cargo.toml` file in Rust 2018, marking the first major update to the language ecosystem three years after its initial release. Editions are opt-in, meaning existing crates will not experience these changes until they explicitly migrate to the new edition.
121+
122+
The major editions of Rust are:
123+
124+
- **Rust 2015**: The initial edition, introduced with Rust 1.0. It established the core language features like ownership, borrowing, and lifetimes, laying the foundation for Rust’s safety and concurrency guarantees.
125+
126+
- **Rust 2018**: The first major update, introduced the `edition` field in `Cargo.toml`, simplified the module system, stabilized `async`/`await`, improved error handling with the `?` operator, and made several syntactic changes.
127+
128+
- **Rust 2021**: Focused on improving ergonomics and removing inconsistencies, such as disjoint closure capture, `IntoIterator` for arrays, and the introduction of or-patterns in macros.
129+
130+
- **Rust 2024**: The latest edition, includes enhancements like refined `async` features, more `const` generics, better diagnostics, and improved Cargo features.
121131

122132
For new projects created by `cargo new`, it will set `edition = "2024"` by default in the `Cargo.toml` file. For example,
123133

@@ -136,4 +146,4 @@ edition = "2024"
136146

137147
- Create an executable crate via `cargo new` command and run it via `cargo run`.
138148

139-
- Create a library crate via `cargo new` command and run `cargo test`.
149+
- Create a library crate via `cargo new` command and run `cargo test`.

0 commit comments

Comments
 (0)