fixed new compiler warnings

This commit is contained in:
pca006132 2021-01-15 17:55:58 +08:00
parent 93493397ae
commit 35204d4716
4 changed files with 6 additions and 8 deletions

View File

@ -3,7 +3,7 @@ use core::{
mem,
slice,
};
use alloc::alloc::{alloc_zeroed, dealloc, Layout, LayoutErr};
use alloc::alloc::{alloc_zeroed, dealloc, Layout, LayoutError};
use super::{
elf::*,
Error,
@ -27,7 +27,7 @@ pub struct Image {
}
impl Image {
pub fn new(size: usize, align: usize) -> Result<Self, LayoutErr> {
pub fn new(size: usize, align: usize) -> Result<Self, LayoutError> {
let layout = Layout::from_size_align(size, align)?;
let data = unsafe {
let ptr = alloc_zeroed(layout);

View File

@ -16,7 +16,6 @@ static CORE1_RESTART: AtomicBool = AtomicBool::new(false);
#[link_section = ".text.boot"]
#[no_mangle]
#[naked]
pub unsafe extern "C" fn IRQ() {
if MPIDR.read().cpu_id() == 1 {
let mpcore = mpcore::RegisterBlock::mpcore();

View File

@ -6,7 +6,6 @@
#![feature(c_variadic)]
#![feature(const_btree_new)]
#![feature(const_in_array_repeat_expressions)]
#![feature(naked_functions)]
extern crate alloc;

View File

@ -75,7 +75,7 @@ async unsafe fn recv_value<F>(stream: &TcpStream, tag: Tag<'async_recursion>, da
}
Tag::List(it) => {
#[repr(C)]
struct List { elements: *mut (), length: u32 };
struct List { elements: *mut (), length: u32 }
consume_value!(List, |ptr| {
let length = proto_async::read_i32(stream).await? as usize;
(*ptr).length = length as u32;
@ -228,7 +228,7 @@ unsafe fn send_value<W>(writer: &mut W, tag: Tag, data: &mut *const ())
}
Tag::List(it) => {
#[repr(C)]
struct List { elements: *const (), length: u32 };
struct List { elements: *const (), length: u32 }
consume_value!(List, |ptr| {
let length = (*ptr).length as isize;
writer.write_u32((*ptr).length)?;
@ -336,7 +336,7 @@ unsafe fn send_value<W>(writer: &mut W, tag: Tag, data: &mut *const ())
}
Tag::Keyword(it) => {
#[repr(C)]
struct Keyword<'a> { name: CSlice<'a, u8> };
struct Keyword<'a> { name: CSlice<'a, u8> }
consume_value!(Keyword, |ptr| {
writer.write_string(str::from_utf8((*ptr).name.as_ref()).unwrap())?;
let tag = it.clone().next().expect("truncated tag");
@ -348,7 +348,7 @@ unsafe fn send_value<W>(writer: &mut W, tag: Tag, data: &mut *const ())
}
Tag::Object => {
#[repr(C)]
struct Object { id: u32 };
struct Object { id: u32 }
consume_value!(*const Object, |ptr|
writer.write_u32((**ptr).id))
}