Skip to content

Commit

Permalink
Bump toolchain to 2024-09-17
Browse files Browse the repository at this point in the history
This commit contains some code changes that have to be made atomically
with the toolchain, to avoid angering our warnings check in the build:

- Removed now-stable asm_const feature
- Fixed some addr_of instances that are now safe (woo!)
  • Loading branch information
cbiffle committed Sep 27, 2024
1 parent 28414e2 commit a744383
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 29 deletions.
41 changes: 26 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ memoffset = { version = "0.6.5", default-features = false }
multimap = { version = "0.8.3", default-features = false }
nb = { version = "1", default-features = false }
num = { version = "0.4", default-features = false }
num-derive = { version = "0.3.3", default-features = false, features = ["full-syntax"] }
num-derive = { version = "0.4", default-features = false }
num-traits = { version = "0.2.12", default-features = false }
p256 = { version = "0.13.2", default-features = false, features = ["ecdsa"] }
panic-halt = { version = "0.2.0", default-features = false }
Expand Down
8 changes: 2 additions & 6 deletions lib/lpc55-rot-startup/src/images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl Image {
) -> Result<Image, ImageError> {
// Make sure we can access the page where the vectors live.
// Safety: Link time constants from our own image.
let vector_size = unsafe { core::ptr::addr_of!(__vector_size) as u32 };
let vector_size = core::ptr::addr_of!(__vector_size) as u32;
if !slot.is_span_programmed(slot.start(), vector_size) {
return Err(ImageError::FirstPageErased);
}
Expand Down Expand Up @@ -248,11 +248,7 @@ impl Image {
// Note that it may not be present if the image
// is corrupted or is a bootloader.
fn get_header_ptr(&self) -> *const ImageHeader {
// Safety: This is generated by the linker script which we trust
// Note that this is generated from _this_ image's linker script
// as opposed to the _image_ linker script but those two _must_
// be the same value!
let vector_size = unsafe { core::ptr::addr_of!(__vector_size) as u32 };
let vector_size = core::ptr::addr_of!(__vector_size) as u32;
(self.get_img_start() + vector_size) as *const ImageHeader
}

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2024-04-04"
channel = "nightly-2024-09-17"
targets = [ "thumbv6m-none-eabi", "thumbv7em-none-eabihf", "thumbv8m.main-none-eabihf" ]
profile = "minimal"
components = [ "rustfmt" ]
1 change: 0 additions & 1 deletion sys/kern/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

#![cfg_attr(target_os = "none", no_std)]
#![feature(naked_functions)]
#![feature(asm_const)]
// Require an unsafe block even in an unsafe fn, because unsafe fns are about
// contract, not implementation.
#![forbid(unsafe_op_in_unsafe_fn)]
Expand Down
5 changes: 1 addition & 4 deletions sys/kern/src/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,8 @@ pub(crate) fn with_task_table<R>(body: impl FnOnce(&mut [Task]) -> R) -> R {
if TASK_TABLE_IN_USE.swap_polyfill(true, Ordering::Acquire) {
panic!(); // recursive use of with_task_table
}
// Safety: tbh it's never been clear to me why addr_of_mut is unsafe when it
// produces a raw pointer, but, see the Safety justification on the
// derefrence below for the full argument on why we can do this.
let task_table: *mut MaybeUninit<[Task; HUBRIS_TASK_COUNT]> =
unsafe { core::ptr::addr_of_mut!(HUBRIS_TASK_TABLE_SPACE) };
core::ptr::addr_of_mut!(HUBRIS_TASK_TABLE_SPACE);
// Pointer cast valid as MaybeUninit<[T; N]> and [MaybeUninit<T>; N] have
// same in-memory representation. At the time of this writing
// MaybeUninit::transpose is not yet stable.
Expand Down
1 change: 0 additions & 1 deletion sys/userlib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
//! See: https://github.com/rust-lang/rust/issues/73450#issuecomment-650463347

#![no_std]
#![feature(asm_const)]
#![feature(naked_functions)]
#![forbid(clippy::wildcard_imports)]

Expand Down

0 comments on commit a744383

Please sign in to comment.