mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-21 15:35:53 +02:00
Update to Rust 2024 edition.
This commit is contained in:
parent
32a8b4bf13
commit
4a07baf9dc
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@ -204,6 +204,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Update Rust
|
||||||
|
run: rustup update
|
||||||
|
|
||||||
- name: Setup Rust cache
|
- name: Setup Rust cache
|
||||||
uses: ./.github/workflows/setup-rust-cache
|
uses: ./.github/workflows/setup-rust-cache
|
||||||
|
|
||||||
|
3
.github/workflows/publish.yml
vendored
3
.github/workflows/publish.yml
vendored
@ -33,6 +33,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0 # We need the full history for build.sh below.
|
fetch-depth: 0 # We need the full history for build.sh below.
|
||||||
|
|
||||||
|
- name: Update Rust
|
||||||
|
run: rustup update
|
||||||
|
|
||||||
- name: Setup Rust cache
|
- name: Setup Rust cache
|
||||||
uses: ./.github/workflows/setup-rust-cache
|
uses: ./.github/workflows/setup-rust-cache
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ src = "src"
|
|||||||
title = "Comprehensive Rust 🦀"
|
title = "Comprehensive Rust 🦀"
|
||||||
|
|
||||||
[rust]
|
[rust]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
extra-watch-dirs = ["po", "third_party"]
|
extra-watch-dirs = ["po", "third_party"]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
cargo install mdbook --locked --version 0.4.44
|
cargo install mdbook --locked --version 0.4.44
|
||||||
cargo install mdbook-svgbob --locked --version 0.2.1
|
cargo install mdbook-svgbob --locked --version 0.2.1
|
||||||
cargo install mdbook-pandoc --locked --version 0.9.3
|
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
|
cargo install i18n-report --locked --version 0.2.0
|
||||||
# these packages are located in this repository
|
# these packages are located in this repository
|
||||||
cargo install --path mdbook-exerciser --locked
|
cargo install --path mdbook-exerciser --locked
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "mdbook-course"
|
name = "mdbook-course"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Dustin Mitchell <djmitche@google.com>"]
|
authors = ["Dustin Mitchell <djmitche@google.com>"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
publish = false
|
publish = false
|
||||||
repository = "https://github.com/google/comprehensive-rust"
|
repository = "https://github.com/google/comprehensive-rust"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "mdbook-exerciser"
|
name = "mdbook-exerciser"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Andrew Walbran <qwandor@google.com>"]
|
authors = ["Andrew Walbran <qwandor@google.com>"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
repository = "https://github.com/google/comprehensive-rust"
|
repository = "https://github.com/google/comprehensive-rust"
|
||||||
description = "A tool for extracting starter code for exercises from Markdown files."
|
description = "A tool for extracting starter code for exercises from Markdown files."
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "mdbook-slide-evaluator"
|
name = "mdbook-slide-evaluator"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Michael Kerscher <kerscher@google.com>"]
|
authors = ["Michael Kerscher <kerscher@google.com>"]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
repository = "https://github.com/google/comprehensive-rust"
|
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"
|
description = "A tool for evaluating mdbook slides by rendering the html pages and spot violations to the policies"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "android-testing"
|
name = "android-testing"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "alloc-example"
|
name = "alloc-example"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -26,13 +26,14 @@ use buddy_system_allocator::LockedHeap;
|
|||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static HEAP_ALLOCATOR: LockedHeap<32> = LockedHeap::<32>::new();
|
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() {
|
pub fn entry() {
|
||||||
// SAFETY: `HEAP` is only used here and `entry` is only called once.
|
// SAFETY: `HEAP` is only used here and `entry` is only called once.
|
||||||
unsafe {
|
unsafe {
|
||||||
// Give the allocator some memory to allocate.
|
// 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.
|
// Now we can do things that require heap allocation.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ap-examples"
|
name = "ap-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -16,8 +16,11 @@ use cc::Build;
|
|||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// SAFETY: The build script is single-threaded.
|
||||||
|
unsafe {
|
||||||
env::set_var("CROSS_COMPILE", "aarch64-none-elf");
|
env::set_var("CROSS_COMPILE", "aarch64-none-elf");
|
||||||
env::set_var("CC", "clang");
|
env::set_var("CC", "clang");
|
||||||
|
}
|
||||||
|
|
||||||
Build::new()
|
Build::new()
|
||||||
.file("entry.S")
|
.file("entry.S")
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "microcontroller-examples"
|
name = "microcontroller-examples"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "allocator-example"
|
name = "allocator-example"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "zerocopy-example"
|
name = "zerocopy-example"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "borrowing"
|
name = "borrowing"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "chat-async"
|
name = "chat-async"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
futures-util = { version = "0.3.31", features = ["sink"] }
|
futures-util = { version = "0.3.31", features = ["sink"] }
|
||||||
|
@ -45,7 +45,7 @@ can use the following `Cargo.toml`:
|
|||||||
[package]
|
[package]
|
||||||
name = "dining-philosophers-async-dine"
|
name = "dining-philosophers-async-dine"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tokio = { version = "1.26.0", features = ["sync", "time", "macros", "rt-multi-thread"] }
|
tokio = { version = "1.26.0", features = ["sync", "time", "macros", "rt-multi-thread"] }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "sync-exercises"
|
name = "sync-exercises"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
@ -51,7 +51,7 @@ You can use the following `Cargo.toml`:
|
|||||||
[package]
|
[package]
|
||||||
name = "dining-philosophers"
|
name = "dining-philosophers"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
@ -34,7 +34,7 @@ The `cargo add` calls will update the `Cargo.toml` file to look like this:
|
|||||||
[package]
|
[package]
|
||||||
name = "link-checker"
|
name = "link-checker"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "control-flow-basics"
|
name = "control-flow-basics"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "error-handling"
|
name = "error-handling"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "compass"
|
name = "compass"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rtc"
|
name = "rtc"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -16,8 +16,11 @@ use cc::Build;
|
|||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// SAFETY: The build script is single-threaded.
|
||||||
|
unsafe {
|
||||||
env::set_var("CROSS_COMPILE", "aarch64-none-elf");
|
env::set_var("CROSS_COMPILE", "aarch64-none-elf");
|
||||||
env::set_var("CC", "clang");
|
env::set_var("CC", "clang");
|
||||||
|
}
|
||||||
|
|
||||||
Build::new()
|
Build::new()
|
||||||
.file("entry.S")
|
.file("entry.S")
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "generics"
|
name = "generics"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "iterators"
|
name = "iterators"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lifetimes"
|
name = "lifetimes"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
thiserror = "*"
|
thiserror = "2.0.11"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "protobuf"
|
name = "protobuf"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "memory-management"
|
name = "memory-management"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "methods-and-traits"
|
name = "methods-and-traits"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "modules"
|
name = "modules"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "pattern-matching"
|
name = "pattern-matching"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "references"
|
name = "references"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "smart-pointers"
|
name = "smart-pointers"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "std-traits"
|
name = "std-traits"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "std-types"
|
name = "std-types"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "testing"
|
name = "testing"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lints.rust]
|
[lints.rust]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tuples-and-arrays"
|
name = "tuples-and-arrays"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "types-and-values"
|
name = "types-and-values"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "unsafe-rust"
|
name = "unsafe-rust"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tempfile = "*"
|
tempfile = "3.17.1"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "listdir"
|
name = "listdir"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "user-defined-types"
|
name = "user-defined-types"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
@ -137,6 +137,8 @@ function playground_text(playground, hidden = true) {
|
|||||||
edition = "2018";
|
edition = "2018";
|
||||||
} else if(classes.contains("edition2021")) {
|
} else if(classes.contains("edition2021")) {
|
||||||
edition = "2021";
|
edition = "2021";
|
||||||
|
} else if(classes.contains("edition2024")) {
|
||||||
|
edition = "2024";
|
||||||
}
|
}
|
||||||
var params = {
|
var params = {
|
||||||
backtrace: true,
|
backtrace: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user