Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Rust toolchain version #57

Merged
merged 8 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//

#![no_std]
#![feature(exposed_provenance)]
#![feature(ptr_metadata)]
#![feature(slice_ptr_get)]
#![feature(strict_provenance)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const HTTP_PORT: u16 = 80;
const HTTPS_PORT: u16 = 443;

pub async fn run_server<
T: BlockIO<ReadOnly, BlockSize = constant_block_sizes::BlockSize512> + Clone,
T: BlockIO<ReadOnly, BlockSize = constant_block_sizes::BlockSize512> + Clone + 'static,
>(
_timers_ctx: TimerManager,
network_ctx: ManagedInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#![no_std]
#![no_main]
#![feature(async_fn_in_trait)]
#![feature(int_roundings)]
#![feature(never_type)]
#![feature(pattern)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#![feature(exclusive_wrapper)]
#![feature(never_type)]
#![feature(unwrap_infallible)]
#![allow(internal_features)]

use core::arch::global_asm;
use core::sync::Exclusive;
Expand Down Expand Up @@ -94,7 +95,7 @@ impl<const N: usize> Stack<N> {
}

#[repr(transparent)]
pub struct StackTop(Exclusive<*mut u8>);
pub struct StackTop(#[allow(dead_code)] Exclusive<*mut u8>);

const STACK_SIZE: usize = 0x4000;

Expand Down
2 changes: 1 addition & 1 deletion crates/private/meta/Cargo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ mk {
sel4-sync
;

sel4-externally-shared = localCrates.sel4-externally-shared // { features = [ "unstable" "very_unstable" ]; };
sel4-externally-shared = localCrates.sel4-externally-shared // { features = [ "unstable" ]; };
sel4-root-task = localCrates.sel4-root-task // { features = [ "full" ]; optional = true; };
sel4-microkit = localCrates.sel4-microkit // { features = [ "full" ]; optional = true; };
sel4-microkit-message = localCrates.sel4-microkit-message // { optional = true; };
Expand Down
5 changes: 1 addition & 4 deletions crates/private/meta/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ sel4-async-time = { path = "../../sel4-async/time" }
sel4-async-unsync = { path = "../../sel4-async/unsync" }
sel4-bounce-buffer-allocator = { path = "../../sel4-bounce-buffer-allocator" }
sel4-config = { path = "../../sel4/config" }
sel4-externally-shared = { path = "../../sel4-externally-shared", features = ["unstable"] }
sel4-immediate-sync-once-cell = { path = "../../sel4-immediate-sync-once-cell" }
sel4-immutable-cell = { path = "../../sel4-immutable-cell" }
sel4-logging = { path = "../../sel4-logging" }
Expand All @@ -49,10 +50,6 @@ sel4-shared-ring-buffer-smoltcp = { path = "../../sel4-shared-ring-buffer/smoltc
sel4-sync = { path = "../../sel4-sync" }
sel4-sys = { path = "../../sel4/sys" }

[dependencies.sel4-externally-shared]
path = "../../sel4-externally-shared"
features = ["unstable", "very_unstable"]

[target."cfg(not(target_arch = \"x86_64\"))".dependencies]
sel4-platform-info = { path = "../../sel4-platform-info", optional = true }

Expand Down
2 changes: 2 additions & 0 deletions crates/private/support/sel4-simple-task/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
#![feature(c_size_t)]
#![feature(const_trait_impl)]
#![feature(core_intrinsics)]
#![feature(exposed_provenance)]
#![feature(lang_items)]
#![feature(linkage)]
#![feature(never_type)]
#![feature(strict_provenance)]
#![feature(thread_local)]
#![feature(unwrap_infallible)]
#![allow(internal_features)]

#[cfg(feature = "alloc")]
extern crate alloc;
Expand Down
6 changes: 2 additions & 4 deletions crates/sel4-async/block-io/fat/src/block_io_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ impl<T: BlockIO<A, BlockSize = constant_block_sizes::BlockSize512>, A: Access> f
_reason: &str,
) -> Result<(), Self::Error> {
future::join_all(blocks.iter_mut().enumerate().map(|(i, block)| async move {
let block_idx = u64::try_from(start_block_idx.0)
.unwrap()
let block_idx = u64::from(start_block_idx.0)
.checked_add(i.try_into().unwrap())
.unwrap();
self.inner
Expand All @@ -65,8 +64,7 @@ impl<T: BlockIO<A, BlockSize = constant_block_sizes::BlockSize512>, A: Access> f
start_block_idx: fat::BlockIdx,
) -> Result<(), Self::Error> {
future::join_all(blocks.iter().enumerate().map(|(i, block)| async move {
let block_idx = u64::try_from(start_block_idx.0)
.unwrap()
let block_idx = u64::from(start_block_idx.0)
.checked_add(i.try_into().unwrap())
.unwrap();
self.inner
Expand Down
1 change: 0 additions & 1 deletion crates/sel4-async/block-io/fat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//

#![no_std]
#![feature(async_fn_in_trait)]
#![feature(never_type)]

pub use embedded_fat::*;
Expand Down
7 changes: 6 additions & 1 deletion crates/sel4-async/block-io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#![no_std]
#![feature(associated_type_bounds)]
#![feature(async_fn_in_trait)]
#![feature(const_option)]
#![feature(int_roundings)]
#![feature(never_type)]
Expand Down Expand Up @@ -47,12 +46,14 @@ pub trait BlockIOLayout {
}

pub trait BlockIO<A: Access>: BlockIOLayout {
#[allow(async_fn_in_trait)]
async fn read_or_write_blocks(
&self,
start_block_idx: u64,
operation: Operation<'_, A>,
) -> Result<(), Self::Error>;

#[allow(async_fn_in_trait)]
async fn read_blocks(&self, start_block_idx: u64, buf: &mut [u8]) -> Result<(), Self::Error>
where
A: ReadAccess,
Expand All @@ -67,6 +68,7 @@ pub trait BlockIO<A: Access>: BlockIOLayout {
.await
}

#[allow(async_fn_in_trait)]
async fn write_blocks(&self, start_block_idx: u64, buf: &[u8]) -> Result<(), Self::Error>
where
A: WriteAccess,
Expand Down Expand Up @@ -342,19 +344,22 @@ pub trait ByteIOLayout {
}

pub trait ByteIO<A: Access>: ByteIOLayout {
#[allow(async_fn_in_trait)]
async fn read_or_write(
&self,
offset: u64,
operation: Operation<'_, A>,
) -> Result<(), Self::Error>;

#[allow(async_fn_in_trait)]
async fn read(&self, offset: u64, buf: &mut [u8]) -> Result<(), Self::Error>
where
A: ReadAccess,
{
self.read_or_write(offset, Operation::read(buf)).await
}

#[allow(async_fn_in_trait)]
async fn write(&self, offset: u64, buf: &[u8]) -> Result<(), Self::Error>
where
A: WriteAccess,
Expand Down
2 changes: 0 additions & 2 deletions crates/sel4-backtrace/types/src/with_symbolize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ use addr2line::gimli::read::Reader;
use addr2line::gimli::Error;
use addr2line::Context;

pub use addr2line::object::File;

use crate::Backtrace;

// TODO handle inlining better (see TODOs scattered throughout this file)
Expand Down
5 changes: 3 additions & 2 deletions crates/sel4-capdl-initializer/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#![no_std]
#![feature(array_try_from_fn)]
#![feature(const_trait_impl)]
#![feature(exposed_provenance)]
#![feature(int_roundings)]
#![feature(never_type)]
#![feature(pointer_is_aligned)]
Expand Down Expand Up @@ -604,8 +605,8 @@ impl<'a, N: ObjectName, D: Content, M: GetEmbeddedFrame, B: BorrowMut<[PerObject
let ipc_buffer_frame = self.orig_local_cptr(obj.ipc_buffer().object);

let authority = BootInfo::init_thread_tcb();
let max_prio = obj.extra.max_prio.try_into()?;
let prio = obj.extra.prio.try_into()?;
let max_prio = obj.extra.max_prio.into();
let prio = obj.extra.prio.into();

#[allow(unused_variables)]
let affinity: usize = obj.extra.affinity.try_into()?;
Expand Down
2 changes: 1 addition & 1 deletion crates/sel4-capdl-initializer/core/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use sel4::SizedFrameType;
use super::frame_types;

#[repr(align(4096))]
struct SmallPagePlaceHolder([u8; frame_types::FrameType0::FRAME_SIZE.bytes()]);
struct SmallPagePlaceHolder(#[allow(dead_code)] [u8; frame_types::FrameType0::FRAME_SIZE.bytes()]);

static SMALL_PAGE_PLACEHOLDER: SmallPagePlaceHolder =
SmallPagePlaceHolder([0; frame_types::FrameType0::FRAME_SIZE.bytes()]);
Expand Down
4 changes: 3 additions & 1 deletion crates/sel4-capdl-initializer/embed-spec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ impl<'a> Embedding<'a> {

fn patch_field(&self, expr_struct: &mut syn::ExprStruct, field_name: &str, value: syn::Expr) {
for field in expr_struct.fields.iter_mut() {
if let syn::Member::Named(ident) = &field.member && ident == field_name {
if let syn::Member::Named(ident) = &field.member
&& ident == field_name
{
field.expr = value.clone();
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/sel4-capdl-initializer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#![no_std]
#![no_main]
#![feature(const_trait_impl)]
#![feature(exposed_provenance)]
#![feature(int_roundings)]
#![feature(pointer_byte_offsets)]
#![feature(strict_provenance)]

extern crate alloc;
Expand Down
1 change: 1 addition & 0 deletions crates/sel4-externally-shared/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#![feature(cfg_target_has_atomic_equal_alignment)]
#![feature(concat_idents)]
#![feature(core_intrinsics)]
#![allow(internal_features)]

use core::ptr::NonNull;

Expand Down
76 changes: 39 additions & 37 deletions crates/sel4-hal-adapters/src/smoltcp/phy/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,26 @@ impl<Device: phy::Device + IrqAck + HasMac> Handler for PhyDeviceHandler<Device>
let mut notify_rx = false;

while !self.rx_ring_buffers.free().is_empty()
&& let Some((rx_tok, _tx_tok)) = self.dev.receive(Instant::ZERO) {
let desc = self.rx_ring_buffers.free_mut().dequeue().unwrap();
let desc_len = usize::try_from(desc.len()).unwrap();

rx_tok.consume(|rx_buf| {
assert!(desc_len >= rx_buf.len());
let buf_range = {
let start = desc.encoded_addr() - self.client_region_paddr;
start..start + rx_buf.len()
};
self.client_region
.as_mut_ptr()
.index(buf_range)
.copy_from_slice(&rx_buf);
});

self.rx_ring_buffers.used_mut().enqueue(desc).unwrap();
notify_rx = true;
}
&& let Some((rx_tok, _tx_tok)) = self.dev.receive(Instant::ZERO)
{
let desc = self.rx_ring_buffers.free_mut().dequeue().unwrap();
let desc_len = usize::try_from(desc.len()).unwrap();

rx_tok.consume(|rx_buf| {
assert!(desc_len >= rx_buf.len());
let buf_range = {
let start = desc.encoded_addr() - self.client_region_paddr;
start..start + rx_buf.len()
};
self.client_region
.as_mut_ptr()
.index(buf_range)
.copy_from_slice(&rx_buf);
});

self.rx_ring_buffers.used_mut().enqueue(desc).unwrap();
notify_rx = true;
}

if notify_rx {
self.rx_ring_buffers.notify().unwrap();
Expand All @@ -109,24 +110,25 @@ impl<Device: phy::Device + IrqAck + HasMac> Handler for PhyDeviceHandler<Device>
let mut notify_tx = false;

while !self.tx_ring_buffers.free().is_empty()
&& let Some(tx_tok) = self.dev.transmit(Instant::ZERO) {
let desc = self.tx_ring_buffers.free_mut().dequeue().unwrap();
let tx_len = usize::try_from(desc.len()).unwrap();

tx_tok.consume(tx_len, |tx_buf| {
let buf_range = {
let start = desc.encoded_addr() - self.client_region_paddr;
start..start + tx_len
};
self.client_region
.as_ptr()
.index(buf_range)
.copy_into_slice(tx_buf);
});

self.tx_ring_buffers.used_mut().enqueue(desc).unwrap();
notify_tx = true;
}
&& let Some(tx_tok) = self.dev.transmit(Instant::ZERO)
{
let desc = self.tx_ring_buffers.free_mut().dequeue().unwrap();
let tx_len = usize::try_from(desc.len()).unwrap();

tx_tok.consume(tx_len, |tx_buf| {
let buf_range = {
let start = desc.encoded_addr() - self.client_region_paddr;
start..start + tx_len
};
self.client_region
.as_ptr()
.index(buf_range)
.copy_into_slice(tx_buf);
});

self.tx_ring_buffers.used_mut().enqueue(desc).unwrap();
notify_tx = true;
}

if notify_tx {
self.tx_ring_buffers.notify().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion crates/sel4-initialize-tls-on-stack/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
//

#![no_std]
#![feature(exposed_provenance)]
#![feature(int_roundings)]
#![feature(strict_provenance)]

use core::arch::{asm, global_asm};
use core::ffi::c_void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
//

#![no_std]
#![feature(const_pointer_byte_offsets)]
#![feature(pointer_byte_offsets)]

use core::marker::PhantomData;

Expand Down
1 change: 1 addition & 0 deletions crates/sel4-kernel-loader/payload-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//

#![no_std]
#![feature(exposed_provenance)]
#![feature(strict_provenance)]
#![deny(unsafe_op_in_unsafe_fn)]
#![allow(clippy::useless_conversion)]
Expand Down
7 changes: 5 additions & 2 deletions crates/sel4-kernel-loader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
#![no_main]
#![feature(associated_type_bounds)]
#![feature(atomic_from_mut)]
#![feature(const_pointer_byte_offsets)]
#![feature(const_trait_impl)]
#![feature(exclusive_wrapper)]
#![feature(pointer_byte_offsets)]
#![feature(exposed_provenance)]
#![feature(proc_macro_hygiene)]
#![feature(strict_provenance)]
#![feature(stdsimd)]
#![cfg_attr(
any(target_arch = "riscv32", target_arch = "riscv64"),
feature(riscv_ext_intrinsics)
)]
#![allow(dead_code)]
#![allow(unreachable_code)]
#![allow(clippy::reversed_empty_ranges)]
Expand Down
2 changes: 1 addition & 1 deletion crates/sel4-kernel-loader/src/rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use core::panic::PanicInfo;
use crate::arch::{Arch, ArchImpl};

#[panic_handler]
extern "C" fn panic_handler(info: &PanicInfo) -> ! {
fn panic_handler(info: &PanicInfo) -> ! {
log::error!("{}", info);
ArchImpl::idle()
}
2 changes: 1 addition & 1 deletion crates/sel4-microkit/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//

pub use sel4_panicking::catch_unwind;
pub use sel4_panicking_env::{abort, debug_print, debug_println};
pub use sel4_panicking_env::abort;

use crate::env::get_ipc_buffer;
use crate::handler::{run_handler, Handler};
Expand Down
2 changes: 0 additions & 2 deletions crates/sel4-microkit/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,3 @@ macro_rules! var {
$symbol.get()
}};
}

pub use var;
Loading