Skip to content

Commit

Permalink
Update toolchain to a working nightly
Browse files Browse the repository at this point in the history
Now that rust-lang/rust#118609 is fixed. The previous
nightly was broken and rolled-back in google#338.
  • Loading branch information
ia0 committed Jan 15, 2024
1 parent 93872be commit 6bb9d7d
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions crates/prelude/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

### Patch

- Fix lints of nightly-2024-01-14
- Use `ENUM::to_result()` to convert errors
- Only depend on `portable-atomic` through `wasefire-sync`
- Use `wasefire-sync::executed!()` to ensure the allocator is initialized at
Expand Down
3 changes: 1 addition & 2 deletions crates/prelude/src/allocator/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ extern "C" fn init() {
struct Pool(MaybeUninit<[u8; SIZE]>);
static mut POOL: Pool = Pool(MaybeUninit::uninit());
// SAFETY: This function is called at most once and POOL is only accessed here.
let pool = unsafe { &mut POOL };
let pool_ptr = NonNull::new(pool.0.as_mut_ptr()).unwrap();
let pool_ptr = NonNull::new(unsafe { POOL.0.as_mut_ptr() }).unwrap();
let mut allocator = ALLOCATOR.0.lock();
// SAFETY: POOL is static and won't be used again.
let size = unsafe { allocator.insert_free_block_ptr(pool_ptr) };
Expand Down
2 changes: 1 addition & 1 deletion crates/prelude/src/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ macro_rules! define {
(#[$m:meta] $n:ident $(, $x:ident)*) => {
#[$m] #[no_mangle]
extern "C" fn $n (
ptr: extern "C" fn(*const u8 $(, usize ${ignore(x)})*),
ptr: extern "C" fn(*const u8 $(, usize ${ignore($x)})*),
this: *const u8 $(, $x: usize)*
) {
ptr(this $(, $x)*);
Expand Down
4 changes: 3 additions & 1 deletion crates/runner-nordic/crates/header/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#![no_std]

use core::ptr::addr_of;

#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct Header(u32);

Expand Down Expand Up @@ -63,7 +65,7 @@ impl Side {
extern "C" {
static mut __header_origin: u32;
}
Self::new(unsafe { &__header_origin as *const u32 } as u32)
Self::new(unsafe { addr_of!(__header_origin) } as u32)
}

fn new(addr: u32) -> Option<Self> {
Expand Down
6 changes: 4 additions & 2 deletions crates/runner-nordic/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use core::ptr::addr_of_mut;

use embedded_alloc::Heap;

#[global_allocator]
Expand All @@ -22,8 +24,8 @@ pub fn init() {
static mut __sheap: u32;
static mut __eheap: u32;
}
let sheap = unsafe { &mut __sheap } as *mut u32 as usize;
let eheap = unsafe { &mut __eheap } as *mut u32 as usize;
let sheap = unsafe { addr_of_mut!(__sheap) as usize };
let eheap = unsafe { addr_of_mut!(__eheap) as usize };
assert!(sheap < eheap);
// Unsafe: Called only once before any allocation.
unsafe { ALLOCATOR.init(sheap, eheap - sheap) }
Expand Down
5 changes: 3 additions & 2 deletions crates/runner-nordic/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use alloc::borrow::Cow;
use alloc::vec;
use core::ptr::addr_of_mut;
use core::slice;

use embedded_storage::nor_flash::{
Expand Down Expand Up @@ -41,8 +42,8 @@ macro_rules! take_storage {
static mut $start: u32;
static mut $end: u32;
}
let start = unsafe { &mut $start as *mut u32 as *mut u8 };
let end = unsafe { &mut $end as *mut u32 as usize };
let start = unsafe { addr_of_mut!($start) as *mut u8 };
let end = unsafe { addr_of_mut!($end) as usize };
let length = end.checked_sub(start as usize).unwrap();
assert_eq!(length % PAGE_SIZE, 0);
unsafe { slice::from_raw_parts_mut(start, length) }
Expand Down
1 change: 1 addition & 0 deletions crates/scheduler/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

### Patch

- Fix lints of nightly-2024-01-24
- Support zero-length slices in native
- Fix board API feature gates for AES-128-CCM and AES-256-GCM
- Remove unreachable `multivalue` feature gates
Expand Down
2 changes: 1 addition & 1 deletion crates/scheduler/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ pub fn process<B: Board>(scheduler: &mut Scheduler<B>, event: Event<B>) {

#[derive(Copy, Clone)]
#[repr(transparent)]
struct U8(*const u8);
struct U8(#[allow(dead_code)] *const u8);
unsafe impl Send for U8 {}

let InstId = inst;
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-2023-11-14"
channel = "nightly-2024-01-14"
components = ["clippy", "llvm-tools", "rust-src", "rustfmt"]
targets = [
"i686-unknown-linux-gnu",
Expand Down

0 comments on commit 6bb9d7d

Please sign in to comment.