From f707d7e7571798cbce29cd896468c61b408c8908 Mon Sep 17 00:00:00 2001 From: WangRunji Date: Tue, 19 Jun 2018 23:43:40 +0800 Subject: [PATCH] Fit new rust nightly. Update dependencies. --- Cargo.toml | 11 +++++------ src/lang.rs | 16 ++++++++++++---- src/lib.rs | 3 ++- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index dd9d215..3918d80 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,18 +20,17 @@ opt-level = 1 debug = true [dependencies] -bit_field = "0.7.0" +bit_field = "0.9.0" rlibc = "1.0" volatile = "0.1.0" -spin = "0.4.5" -multiboot2 = "0.5" +spin = "0.4.8" +multiboot2 = "0.6" bitflags = "1.0" -x86_64 = "0.2.3" +x86_64 = "0.2.6" once = "0.3.3" -linked_list_allocator = "0.5.0" +linked_list_allocator = "0.6" redox_syscall = "0.1" xmas-elf = "0.6" -arrayvec = { version = "0.4.7", default-features = false } log = "0.4" lazy_static = { version = "1.0.0", features = ["spin_no_std"] } simple-filesystem = { git = "https://github.com/wangrunji0408/SimpleFileSystem-Rust" } diff --git a/src/lang.rs b/src/lang.rs index 1fa1686..93d316b 100644 --- a/src/lang.rs +++ b/src/lang.rs @@ -1,19 +1,27 @@ // Rust language features implementions -use core; +use core::panic::PanicInfo; use arch::cpu; #[lang = "eh_personality"] extern fn eh_personality() { } -#[lang = "panic_fmt"] +#[panic_implementation] #[no_mangle] -pub extern fn panic_fmt(fmt: core::fmt::Arguments, file: &'static str, line: u32) -> ! { - error!("\n\nPANIC in {} at line {}\n {}", file, line, fmt); +pub fn panic(info: &PanicInfo) -> ! { + let location = info.location().unwrap(); + let message = info.message().unwrap(); + error!("\n\nPANIC in {} at line {}\n {}", location.file(), location.line(), message); if cfg!(feature = "qemu_auto_exit") { unsafe{ cpu::exit_in_qemu(3) } } else { loop { } } } + +#[lang = "oom"] +#[no_mangle] +fn oom() -> ! { + panic!("out of memory"); +} diff --git a/src/lib.rs b/src/lib.rs index 15c5be2..89587a2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,12 +12,13 @@ #![feature(naked_functions)] #![feature(asm)] #![feature(optin_builtin_traits)] +#![feature(panic_implementation)] +#![feature(panic_info_message)] #![no_std] #[macro_use] extern crate alloc; -extern crate arrayvec; extern crate bit_allocator; extern crate bit_field; #[macro_use]