8000 Update to new panic_implementation attribute (#17) · rust-osdev/bootloader@5bf74c5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5bf74c5

Browse files
IsaacWoodsphil-opp
authored andcommitted
Update to new panic_implementation attribute (#17)
1 parent 261660b commit 5bf74c5

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/main.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#![feature(pointer_methods)]
99
#![feature(const_fn)]
1010
#![feature(nll)]
11+
#![feature(panic_implementation)]
1112
#![no_std]
1213
#![no_main]
1314

@@ -19,6 +20,7 @@ extern crate xmas_elf;
1920
extern crate fixedvec;
2021

2122
use core::slice;
23+
use core::panic::PanicInfo;
2224
use os_bootinfo::BootInfo;
2325
use usize_conversions::usize_from;
2426
use x86_64::structures::paging::{Mapper, RecursivePageTable};
@@ -214,17 +216,11 @@ fn enable_write_protect_bit() {
214216
unsafe { Cr0::update(|cr0| *cr0 |= Cr0Flags::WRITE_PROTECT) };
215217
}
216218

217-
#[lang = "panic_fmt"]
219+
#[panic_implemen 903E tation]
218220
#[no_mangle]
219-
pub extern "C" fn rust_begin_panic(
220-
msg: core::fmt::Arguments,
221-
file: &'static str,
222-
line: u32,
223-
_column: u32,
224-
) -> ! {
221+
pub extern "C" fn panic(info: &PanicInfo) -> ! {
225222
use core::fmt::Write;
226-
write!(printer::Printer, "PANIC: {} in {}:{}", msg, file, line).unwrap();
227-
223+
write!(printer::Printer, "{}", info).unwrap();
228224
loop {}
229225
}
230226

0 commit comments

Comments
 (0)
0