mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-16 07:36:05 +02:00
Update to Rust 2024 edition.
This commit is contained in:
parent
5211436446
commit
bb9c967e93
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@ -206,6 +206,9 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Update Rust
|
||||
run: rustup update
|
||||
|
||||
- name: 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:
|
||||
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
|
||||
|
||||
|
@ -5,7 +5,7 @@ src = "src"
|
||||
title = "Comprehensive Rust 🦀"
|
||||
|
||||
[rust]
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[build]
|
||||
extra-watch-dirs = ["po", "third_party"]
|
||||
|
@ -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"
|
||||
|
@ -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."
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "android-testing"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[[example]]
|
||||
|
@ -3,7 +3,7 @@
|
||||
[package]
|
||||
name = "alloc-example"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
|
@ -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.
|
||||
|
@ -3,7 +3,7 @@
|
||||
[package]
|
||||
name = "ap-examples"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
|
@ -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")
|
||||
|
@ -3,7 +3,7 @@
|
||||
[package]
|
||||
name = "microcontroller-examples"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "allocator-example"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "zerocopy-example"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "borrowing"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
|
@ -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"] }
|
||||
|
@ -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"] }
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "sync-exercises"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[[bin]]
|
||||
|
@ -51,7 +51,7 @@ You can use the following `Cargo.toml`:
|
||||
[package]
|
||||
name = "dining-philosophers"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
```
|
||||
|
||||
<details>
|
||||
|
@ -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]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "control-flow-basics"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[[bin]]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "error-handling"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
|
@ -3,7 +3,7 @@
|
||||
[package]
|
||||
name = "compass"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
|
@ -3,7 +3,7 @@
|
||||
[package]
|
||||
name = "rtc"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
|
@ -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")
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "generics"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "iterators"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
|
@ -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"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "memory-management"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[[bin]]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "methods-and-traits"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[[bin]]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "modules"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[[bin]]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "pattern-matching"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "references"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[[bin]]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "smart-pointers"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "std-traits"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "std-types"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[[bin]]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "testing"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[lints.rust]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "tuples-and-arrays"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[[bin]]
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "types-and-values"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[[bin]]
|
||||
|
@ -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"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "user-defined-types"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[[bin]]
|
||||
|
@ -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,
|
||||
|
@ -57,10 +57,10 @@ fn install_tools() -> Result<()> {
|
||||
let install_args = vec![
|
||||
// The --locked flag is important for reproducible builds. It also
|
||||
// avoids breakage due to skews between mdbook and mdbook-svgbob.
|
||||
vec!["mdbook", "--locked", "--version", "0.4.44"],
|
||||
vec!["mdbook-svgbob", "--locked", "--version", "0.2.1"],
|
||||
vec!["mdbook", "--locked", "--version", "0.4.48"],
|
||||
vec!["mdbook-svgbob", "--locked", "--version", "0.2.2"],
|
||||
vec!["mdbook-pandoc", "--locked", "--version", "0.9.3"],
|
||||
vec!["mdbook-i18n-helpers", "--locked", "--version", "0.3.5"],
|
||||
vec!["mdbook-i18n-helpers", "--locked", "--version", "0.3.6"],
|
||||
vec!["i18n-report", "--locked", "--version", "0.2.0"],
|
||||
// These packages are located in this repository
|
||||
vec!["--path", "mdbook-exerciser", "--locked"],
|
||||
|
Loading…
x
Reference in New Issue
Block a user