mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Define panic handler using new panic_implementation attribute (#435)
This commit is contained in:
committed by
GitHub
parent
3b8f9c7d36
commit
3f61050387
14
src/main.rs
14
src/main.rs
@@ -1,4 +1,4 @@
|
||||
#![feature(lang_items)] // required for defining the panic handler
|
||||
#![feature(panic_implementation)] // required for defining the panic handler
|
||||
#![no_std] // don't link the Rust standard library
|
||||
#![cfg_attr(not(test), no_main)] // disable all Rust-level entry points
|
||||
#![cfg_attr(test, allow(dead_code, unused_macros))] // allow unused code in test mode
|
||||
@@ -13,6 +13,8 @@ extern crate array_init;
|
||||
#[cfg(test)]
|
||||
extern crate std;
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
#[macro_use]
|
||||
mod vga_buffer;
|
||||
|
||||
@@ -27,14 +29,8 @@ pub extern "C" fn _start() -> ! {
|
||||
}
|
||||
|
||||
/// This function is called on panic.
|
||||
#[cfg(not(test))]
|
||||
#[lang = "panic_fmt"]
|
||||
#[panic_implementation]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn rust_begin_panic(
|
||||
_msg: core::fmt::Arguments,
|
||||
_file: &'static str,
|
||||
_line: u32,
|
||||
_column: u32,
|
||||
) -> ! {
|
||||
pub fn panic(_info: &PanicInfo) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user