Skip to content

Commit

Permalink
Fix all warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
roblabla committed Sep 25, 2018
1 parent 321b6b1 commit 2c3ea6d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 5 additions & 5 deletions kernel/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ pub trait Waitable: Debug {
///
/// Allows waiting on multiple Waitables at the same time.
#[derive(Debug)]
pub struct MultiWaiter<'WAIT> {
waitable: &'WAIT [&'WAIT Waitable]
pub struct MultiWaiter<'wait> {
waitable: &'wait [&'wait Waitable]
}

impl<'WAIT> MultiWaiter<'WAIT> {
pub fn new(arr: &'WAIT [&'WAIT Waitable]) -> MultiWaiter<'WAIT> {
impl<'wait> MultiWaiter<'wait> {
pub fn new(arr: &'wait [&'wait Waitable]) -> MultiWaiter<'wait> {
MultiWaiter {
waitable: arr
}
}

pub fn wait(&self) -> &'WAIT Waitable {
pub fn wait(&self) -> &'wait Waitable {
loop {
// Early-check for events that have already been signaled.
for item in self.waitable {
Expand Down
9 changes: 7 additions & 2 deletions kernel/src/i386/structures/idt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,12 @@ pub struct Idt {
pub interrupts: [IdtEntry<HandlerFunc>; 256 - 32],
}

const_assert_eq!(const_assert_idt; mem::size_of::<Idt>(), 256 * 8);


impl Idt {
/// Creates a new IDT filled with non-present entries.
pub fn init(&mut self) {
debug_assert_eq!(mem::size_of::<Self>(), 256 * 8);
self.divide_by_zero = IdtEntry::missing();
self.debug = IdtEntry::missing();
self.non_maskable_interrupt = IdtEntry::missing();
Expand Down Expand Up @@ -463,7 +465,7 @@ impl IndexMut<usize> for Idt {
/// The generic parameter can either be `HandlerFunc` or `HandlerFuncWithErrCode`, depending
/// on the interrupt vector.
#[derive(Debug, Clone, Copy)]
#[repr(C, packed)]
#[repr(C)]
pub struct IdtEntry<F> {
pointer_low: u16,
gdt_selector: u16,
Expand All @@ -473,6 +475,9 @@ pub struct IdtEntry<F> {
phantom: PhantomData<F>,
}


const_assert_eq!(const_assert_idtentry; mem::size_of::<IdtEntry<()>>(), 8);

/// A handler function for an interrupt or an exception without error code.
pub type HandlerFunc = extern "x86-interrupt" fn(&mut ExceptionStackFrame);
/// A handler function for an exception that pushes an error code.
Expand Down
3 changes: 3 additions & 0 deletions kernel/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ mod io;
mod devices;
mod sync;

// Make rust happy about rust_oom being no_mangle...
pub use heap_allocator::rust_oom;

#[global_allocator]
static ALLOCATOR: heap_allocator::Allocator = heap_allocator::Allocator::new();

Expand Down

0 comments on commit 2c3ea6d

Please sign in to comment.