From ba5ba71372f9224d325d6a0a8f1bb97fe86f484f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Przytu=C5=82a?= Date: Wed, 28 Aug 2024 20:45:19 +0200 Subject: [PATCH] Bump Rust to version 1.77 When trying to build rowan we get this error error: package `rowan v0.15.16` cannot be built because it requires rustc 1.77.0 or newer, while the currently active rustc version is 1.75.0 So let's upgrade to 1.77 to allow us to build rowan. --- Cargo.toml | 2 +- doc/PlatformDesignStory.md | 2 +- platform/src/share/tests.rs | 2 +- rust-toolchain.toml | 12 +++++++----- syscalls_tests/src/allow_ro.rs | 2 +- syscalls_tests/src/allow_rw.rs | 2 +- syscalls_tests/src/subscribe_tests.rs | 4 ++-- tock | 2 +- unittest/src/kernel_data.rs | 2 +- 9 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2accd7a9..b1d956d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ version = "0.1.0" [workspace.package] # This must be kept in sync with rust-toolchain.toml; please see that file for # more information. -rust-version = "1.75" +rust-version = "1.77" [features] rust_embedded = [ diff --git a/doc/PlatformDesignStory.md b/doc/PlatformDesignStory.md index c9225d2e..1a696159 100644 --- a/doc/PlatformDesignStory.md +++ b/doc/PlatformDesignStory.md @@ -429,7 +429,7 @@ macro_rules! test_component { [$link:ident, $name:ident: $comp:ty = $init:expr] => { let $name = std::boxed::Box::leak(std::boxed::Box::new($init)) as &$comp; std::thread_local!(static GLOBAL: std::cell::Cell> - = std::cell::Cell::new(None)); + = const {std::cell::Cell::new(None)}) GLOBAL.with(|g| g.set(Some($name))); struct $link; impl libtock_platform::FreeCallback for $link diff --git a/platform/src/share/tests.rs b/platform/src/share/tests.rs index a68fae0c..00262cc9 100644 --- a/platform/src/share/tests.rs +++ b/platform/src/share/tests.rs @@ -1,6 +1,6 @@ use crate::share::{scope, Handle, List}; -std::thread_local! {static INSTANCE_COUNT: core::cell::Cell = core::cell::Cell::new(0)} +std::thread_local! {static INSTANCE_COUNT: core::cell::Cell = const {core::cell::Cell::new(0)}} // InstanceCounter increments INSTANCE_COUNT when it is constructed and // decrements INSTANCE_COUNT when it is dropped. diff --git a/rust-toolchain.toml b/rust-toolchain.toml index c7355f98..795603e6 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -5,9 +5,11 @@ # you'd like to use. When you do so, update this to the first Rust version that # includes that feature. Whenever this value is updated, the rust-version field # in Cargo.toml must be updated as well. -channel = "1.75" +channel = "1.77" components = ["clippy", "rustfmt"] -targets = ["thumbv6m-none-eabi", - "thumbv7em-none-eabi", - "riscv32imac-unknown-none-elf", - "riscv32imc-unknown-none-elf"] +targets = [ + "thumbv6m-none-eabi", + "thumbv7em-none-eabi", + "riscv32imac-unknown-none-elf", + "riscv32imc-unknown-none-elf", +] diff --git a/syscalls_tests/src/allow_ro.rs b/syscalls_tests/src/allow_ro.rs index 4c3e8dd2..87010690 100644 --- a/syscalls_tests/src/allow_ro.rs +++ b/syscalls_tests/src/allow_ro.rs @@ -33,7 +33,7 @@ impl fake::SyscallDriver for TestDriver { struct TestConfig; // CALLED is set to true when returned_nonzero_buffer is called. -thread_local! {static CALLED: Cell = Cell::new(false); } +thread_local! {static CALLED: Cell = const {Cell::new(false)} } impl allow_ro::Config for TestConfig { fn returned_nonzero_buffer(driver_num: u32, buffer_num: u32) { diff --git a/syscalls_tests/src/allow_rw.rs b/syscalls_tests/src/allow_rw.rs index 9068c75b..300dd250 100644 --- a/syscalls_tests/src/allow_rw.rs +++ b/syscalls_tests/src/allow_rw.rs @@ -33,7 +33,7 @@ impl fake::SyscallDriver for TestDriver { struct TestConfig; // CALLED is set to true when returned_nonzero_buffer is called. -thread_local! {static CALLED: Cell = Cell::new(false); } +thread_local! {static CALLED: Cell = const {Cell::new(false)} } impl allow_rw::Config for TestConfig { fn returned_nonzero_buffer(driver_num: u32, buffer_num: u32) { diff --git a/syscalls_tests/src/subscribe_tests.rs b/syscalls_tests/src/subscribe_tests.rs index 69dc8683..673f7d5e 100644 --- a/syscalls_tests/src/subscribe_tests.rs +++ b/syscalls_tests/src/subscribe_tests.rs @@ -2,7 +2,7 @@ use libtock_platform::{ share, subscribe, CommandReturn, DefaultConfig, ErrorCode, Syscalls, YieldNoWaitReturn, }; use libtock_unittest::{command_return, fake, DriverInfo, DriverShareRef, SyscallLogEntry}; -use std::rc::Rc; +use std::{cell::Cell, rc::Rc}; // Fake driver that accepts an upcall. #[derive(Default)] @@ -28,7 +28,7 @@ impl fake::SyscallDriver for MockDriver { fn config() { // Thread local used by TestConfig to indicate that returned_nonnull_upcall // has been called. - std::thread_local! {static CALLED: core::cell::Cell> = Default::default(); } + std::thread_local! {static CALLED: core::cell::Cell> = const {Cell::new(None)} } struct TestConfig; impl subscribe::Config for TestConfig { fn returned_nonnull_upcall(driver_num: u32, subscribe_num: u32) { diff --git a/tock b/tock index 8b28201b..b3234a17 160000 --- a/tock +++ b/tock @@ -1 +1 @@ -Subproject commit 8b28201bce7dd7b832de469b34a83457b2cc4ceb +Subproject commit b3234a1722f40eef19fa90959d5ad552b39c6f22 diff --git a/unittest/src/kernel_data.rs b/unittest/src/kernel_data.rs index 6d0388b8..fbcec0d8 100644 --- a/unittest/src/kernel_data.rs +++ b/unittest/src/kernel_data.rs @@ -28,7 +28,7 @@ pub(crate) struct KernelData { // KERNEL_DATA is set to Some in `fake::Kernel::new` and set to None when the // `fake::Kernel` is dropped. -thread_local!(pub(crate) static KERNEL_DATA: RefCell> = RefCell::new(None)); +thread_local!(pub(crate) static KERNEL_DATA: RefCell> = const { RefCell::new(None) }); // Convenience function to get mutable access to KERNEL_DATA. pub(crate) fn with_kernel_data) -> R, R>(f: F) -> R {