1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-21 07:27:01 +02:00

Update to Rust 2024 edition.

This commit is contained in:
Andrew Walbran 2025-02-25 17:44:42 +00:00
parent 32a8b4bf13
commit 4a07baf9dc
43 changed files with 60 additions and 45 deletions

View File

@ -204,6 +204,9 @@ jobs:
with:
fetch-depth: 0
- name: Update Rust
run: rustup update
- name: Setup Rust cache
uses: ./.github/workflows/setup-rust-cache

View File

@ -33,6 +33,9 @@ jobs:
with:
fetch-depth: 0 # We need the full history for build.sh below.
- name: Update Rust
run: rustup update
- name: Setup Rust cache
uses: ./.github/workflows/setup-rust-cache

View File

@ -6,7 +6,7 @@ src = "src"
title = "Comprehensive Rust 🦀"
[rust]
edition = "2021"
edition = "2024"
[build]
extra-watch-dirs = ["po", "third_party"]

View File

@ -4,7 +4,7 @@
cargo install mdbook --locked --version 0.4.44
cargo install mdbook-svgbob --locked --version 0.2.1
cargo install mdbook-pandoc --locked --version 0.9.3
cargo install mdbook-i18n-helpers --locked --version 0.3.5
cargo install mdbook-i18n-helpers --locked --version 0.3.6
cargo install i18n-report --locked --version 0.2.0
# these packages are located in this repository
cargo install --path mdbook-exerciser --locked

View File

@ -2,7 +2,7 @@
name = "mdbook-course"
version = "0.1.0"
authors = ["Dustin Mitchell <djmitche@google.com>"]
edition = "2021"
edition = "2024"
license = "Apache-2.0"
publish = false
repository = "https://github.com/google/comprehensive-rust"

View File

@ -2,7 +2,7 @@
name = "mdbook-exerciser"
version = "0.1.0"
authors = ["Andrew Walbran <qwandor@google.com>"]
edition = "2021"
edition = "2024"
license = "Apache-2.0"
repository = "https://github.com/google/comprehensive-rust"
description = "A tool for extracting starter code for exercises from Markdown files."

View File

@ -2,7 +2,7 @@
name = "mdbook-slide-evaluator"
version = "0.1.0"
authors = ["Michael Kerscher <kerscher@google.com>"]
edition = "2021"
edition = "2024"
license = "Apache-2.0"
repository = "https://github.com/google/comprehensive-rust"
description = "A tool for evaluating mdbook slides by rendering the html pages and spot violations to the policies"

View File

@ -1,7 +1,7 @@
[package]
name = "android-testing"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[[example]]

View File

@ -3,7 +3,7 @@
[package]
name = "alloc-example"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@ -26,13 +26,14 @@ use buddy_system_allocator::LockedHeap;
#[global_allocator]
static HEAP_ALLOCATOR: LockedHeap<32> = LockedHeap::<32>::new();
static mut HEAP: [u8; 65536] = [0; 65536];
const HEAP_SIZE: usize = 65536;
static mut HEAP: [u8; HEAP_SIZE] = [0; HEAP_SIZE];
pub fn entry() {
// SAFETY: `HEAP` is only used here and `entry` is only called once.
unsafe {
// Give the allocator some memory to allocate.
HEAP_ALLOCATOR.lock().init(HEAP.as_mut_ptr() as usize, HEAP.len());
HEAP_ALLOCATOR.lock().init(&raw mut HEAP as usize, HEAP_SIZE);
}
// Now we can do things that require heap allocation.

View File

@ -3,7 +3,7 @@
[package]
name = "ap-examples"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@ -16,8 +16,11 @@ use cc::Build;
use std::env;
fn main() {
env::set_var("CROSS_COMPILE", "aarch64-none-elf");
env::set_var("CC", "clang");
// SAFETY: The build script is single-threaded.
unsafe {
env::set_var("CROSS_COMPILE", "aarch64-none-elf");
env::set_var("CC", "clang");
}
Build::new()
.file("entry.S")

View File

@ -3,7 +3,7 @@
[package]
name = "microcontroller-examples"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@ -1,7 +1,7 @@
[package]
name = "allocator-example"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@ -1,7 +1,7 @@
[package]
name = "zerocopy-example"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@ -1,7 +1,7 @@
[package]
name = "borrowing"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[lib]

View File

@ -1,7 +1,7 @@
[package]
name = "chat-async"
version = "0.1.0"
edition = "2021"
edition = "2024"
[dependencies]
futures-util = { version = "0.3.31", features = ["sink"] }

View File

@ -45,7 +45,7 @@ can use the following `Cargo.toml`:
[package]
name = "dining-philosophers-async-dine"
version = "0.1.0"
edition = "2021"
edition = "2024"
[dependencies]
tokio = { version = "1.26.0", features = ["sync", "time", "macros", "rt-multi-thread"] }

View File

@ -1,7 +1,7 @@
[package]
name = "sync-exercises"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[[bin]]

View File

@ -51,7 +51,7 @@ You can use the following `Cargo.toml`:
[package]
name = "dining-philosophers"
version = "0.1.0"
edition = "2021"
edition = "2024"
```
<details>

View File

@ -34,7 +34,7 @@ The `cargo add` calls will update the `Cargo.toml` file to look like this:
[package]
name = "link-checker"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@ -1,7 +1,7 @@
[package]
name = "control-flow-basics"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[[bin]]

View File

@ -1,7 +1,7 @@
[package]
name = "error-handling"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@ -3,7 +3,7 @@
[package]
name = "compass"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@ -3,7 +3,7 @@
[package]
name = "rtc"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@ -16,8 +16,11 @@ use cc::Build;
use std::env;
fn main() {
env::set_var("CROSS_COMPILE", "aarch64-none-elf");
env::set_var("CC", "clang");
// SAFETY: The build script is single-threaded.
unsafe {
env::set_var("CROSS_COMPILE", "aarch64-none-elf");
env::set_var("CC", "clang");
}
Build::new()
.file("entry.S")

View File

@ -1,7 +1,7 @@
[package]
name = "generics"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[lib]

View File

@ -1,7 +1,7 @@
[package]
name = "iterators"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[lib]

View File

@ -1,11 +1,11 @@
[package]
name = "lifetimes"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]
thiserror = "*"
thiserror = "2.0.11"
[lib]
name = "protobuf"

View File

@ -1,7 +1,7 @@
[package]
name = "memory-management"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[[bin]]

View File

@ -1,7 +1,7 @@
[package]
name = "methods-and-traits"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[[bin]]

View File

@ -1,7 +1,7 @@
[package]
name = "modules"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[[bin]]

View File

@ -1,7 +1,7 @@
[package]
name = "pattern-matching"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[lib]

View File

@ -1,7 +1,7 @@
[package]
name = "references"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[[bin]]

View File

@ -1,7 +1,7 @@
[package]
name = "smart-pointers"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[lib]

View File

@ -1,7 +1,7 @@
[package]
name = "std-traits"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[lib]

View File

@ -1,7 +1,7 @@
[package]
name = "std-types"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[[bin]]

View File

@ -1,7 +1,7 @@
[package]
name = "testing"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[lints.rust]

View File

@ -1,7 +1,7 @@
[package]
name = "tuples-and-arrays"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[[bin]]

View File

@ -1,7 +1,7 @@
[package]
name = "types-and-values"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[[bin]]

View File

@ -1,11 +1,11 @@
[package]
name = "unsafe-rust"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]
tempfile = "*"
tempfile = "3.17.1"
[[bin]]
name = "listdir"

View File

@ -1,7 +1,7 @@
[package]
name = "user-defined-types"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[[bin]]

View File

@ -137,6 +137,8 @@ function playground_text(playground, hidden = true) {
edition = "2018";
} else if(classes.contains("edition2021")) {
edition = "2021";
} else if(classes.contains("edition2024")) {
edition = "2024";
}
var params = {
backtrace: true,