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

Upgrade to Rust 2021 #294

Merged
merged 2 commits into from
Nov 23, 2021
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ keywords = ["unikernel", "libos"]
categories = ["os"]
repository = "https://github.com/hermitcore/rusty-hermit"
documentation = "https://hermitcore.github.io/libhermit-rs/hermit/"
edition = "2018"
edition = "2021"
description = "A Rust-based library operting system"
exclude = [
"/.github/*",
Expand Down
2 changes: 1 addition & 1 deletion src/arch/aarch64/mm/physicalmem.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::{alloc::AllocError, convert::TryInto};
use core::alloc::AllocError;

use crate::arch::aarch64::mm::paging::{BasePageSize, PageSize};
use crate::arch::aarch64::mm::{PhysAddr, VirtAddr};
Expand Down
2 changes: 1 addition & 1 deletion src/arch/aarch64/mm/virtualmem.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::{alloc::AllocError, convert::TryInto};
use core::alloc::AllocError;

use crate::arch::aarch64::mm::paging::{BasePageSize, PageSize};
use crate::arch::aarch64::mm::{PhysAddr, VirtAddr};
Expand Down
2 changes: 0 additions & 2 deletions src/arch/x86_64/kernel/apic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ use alloc::boxed::Box;
use alloc::vec::Vec;
use arch::x86_64::kernel::{idt, irq, percore::*, processor, BOOT_INFO};
use core::arch::x86_64::_mm_mfence;
#[cfg(feature = "smp")]
use core::convert::TryInto;
use core::hint::spin_loop;
#[cfg(feature = "smp")]
use core::ptr;
Expand Down
1 change: 0 additions & 1 deletion src/arch/x86_64/kernel/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use alloc::collections::BTreeMap;
use core::convert::TryInto;
#[cfg(feature = "newlib")]
use core::slice;
use core::{intrinsics, ptr};
Expand Down
1 change: 0 additions & 1 deletion src/arch/x86_64/kernel/pci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use crate::drivers::virtio::transport::pci::VirtioDriver;
use crate::synch::spinlock::SpinlockIrqSave;
use crate::x86::io::*;
use alloc::vec::Vec;
use core::convert::TryInto;
use core::{fmt, u32, u8};

// TODO: should these be pub? currently needed since used in virtio.rs maybe use getter methods to be more flexible.
Expand Down
1 change: 0 additions & 1 deletion src/arch/x86_64/kernel/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use core::arch::x86_64::{
__rdtscp, _fxrstor, _fxsave, _mm_lfence, _rdrand32_step, _rdrand64_step, _rdtsc, _xrstor,
_xsave,
};
use core::convert::TryInto;
use core::hint::spin_loop;
use core::{fmt, u32};
use qemu_exit::QEMUExit;
Expand Down
1 change: 0 additions & 1 deletion src/arch/x86_64/kernel/scheduler.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Architecture dependent interface to initialize a task

use alloc::alloc::{alloc, dealloc, Layout};
use core::convert::TryInto;
use core::{mem, ptr};

use crate::arch::x86_64::kernel::apic;
Expand Down
1 change: 0 additions & 1 deletion src/arch/x86_64/mm/paging.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use core::convert::TryInto;
use core::marker::PhantomData;
use core::mem;
use core::ptr;
Expand Down
2 changes: 1 addition & 1 deletion src/arch/x86_64/mm/physicalmem.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::alloc::AllocError;
use core::sync::atomic::{AtomicUsize, Ordering};
use core::{alloc::AllocError, convert::TryInto};
use multiboot::information::{MemoryType, Multiboot};

use crate::arch::x86_64::kernel::{get_limit, get_mbinfo};
Expand Down
2 changes: 1 addition & 1 deletion src/arch/x86_64/mm/virtualmem.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::{alloc::AllocError, convert::TryInto};
use core::alloc::AllocError;

use crate::arch::x86_64::mm::paging::{BasePageSize, PageSize};
use crate::arch::x86_64::mm::VirtAddr;
Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/rtl8139.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#![allow(dead_code)]

use core::convert::TryInto;
use core::mem;

use crate::arch::kernel::irq::*;
Expand Down
1 change: 0 additions & 1 deletion src/drivers/net/virtio_net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use alloc::boxed::Box;
use alloc::collections::VecDeque;
use alloc::rc::Rc;
use alloc::vec::Vec;
use core::convert::TryFrom;
use core::mem;
use core::result::Result;
use core::{cell::RefCell, cmp::Ordering};
Expand Down
1 change: 0 additions & 1 deletion src/drivers/virtio/depr/virtio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use crate::config::VIRTIO_MAX_QUEUE_SIZE;
use alloc::boxed::Box;
use alloc::rc::Rc;
use alloc::vec::Vec;
use core::convert::TryInto;
use core::hint::spin_loop;
use core::sync::atomic::{fence, Ordering};
use core::{cell::RefCell, ptr};
Expand Down
1 change: 0 additions & 1 deletion src/drivers/virtio/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//! ensure only a single location needs changes, in cases where the underlying kernel code is changed

pub mod memory {
use core::convert::TryFrom;
use core::ops::Add;

/// A newtype representing a memory offset which can be used to be added to [PhyMemAddr](PhyMemAddr) or
Expand Down
1 change: 0 additions & 1 deletion src/drivers/virtio/transport/pci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use crate::arch::kernel::pci::{PciAdapter, PciDriver};
use crate::arch::mm::PhysAddr;
use crate::synch::spinlock::SpinlockIrqSave;
use alloc::vec::Vec;
use core::convert::TryInto;
use core::mem;
use core::result::Result;

Expand Down
1 change: 0 additions & 1 deletion src/drivers/virtio/virtqueue/packed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use alloc::boxed::Box;
use alloc::collections::VecDeque;
use alloc::rc::Rc;
use alloc::vec::Vec;
use core::convert::TryFrom;
use core::sync::atomic::{fence, Ordering};
use core::{cell::RefCell, ptr};

Expand Down
1 change: 0 additions & 1 deletion src/drivers/virtio/virtqueue/split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use alloc::boxed::Box;
use alloc::collections::VecDeque;
use alloc::rc::Rc;
use alloc::vec::Vec;
use core::convert::TryFrom;
use core::sync::atomic::{fence, Ordering};
use core::{cell::RefCell, ptr};

Expand Down
3 changes: 0 additions & 3 deletions src/scheduler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ use alloc::collections::{BTreeMap, VecDeque};
use alloc::rc::Rc;
use alloc::vec::Vec;
use core::cell::RefCell;
#[cfg(feature = "smp")]
use core::convert::TryFrom;
use core::convert::TryInto;
use core::sync::atomic::{AtomicU32, Ordering};
use crossbeam_utils::Backoff;

Expand Down
1 change: 0 additions & 1 deletion src/scheduler/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use alloc::collections::{LinkedList, VecDeque};
use alloc::rc::Rc;
use core::cell::RefCell;
use core::cmp::Ordering;
use core::convert::TryInto;
use core::fmt;
use core::num::NonZeroU64;

Expand Down
1 change: 0 additions & 1 deletion src/syscalls/interfaces/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use alloc::boxed::Box;
use alloc::vec::Vec;
use core::convert::{TryFrom, TryInto};
use core::{isize, ptr, slice, str};

use crate::arch;
Expand Down
1 change: 0 additions & 1 deletion src/syscalls/processor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::arch::get_processor_count;
use core::convert::TryInto;

extern "C" fn __sys_get_processor_count() -> usize {
get_processor_count().try_into().unwrap()
Expand Down