Skip to content
Snippets Groups Projects
Commit 8c583cc9 authored by Peter Limkilde Svendsen's avatar Peter Limkilde Svendsen Committed by Jeremy Soller
Browse files

Use unsafe blocks in assert.h implementation

parent 3da3ff11
No related branches found
No related tags found
No related merge requests found
//! assert implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/assert.h.html //! assert implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/assert.h.html
// TODO: set this for entire crate when possible
#![deny(unsafe_op_in_unsafe_fn)]
use crate::{c_str::CStr, platform::types::*}; use crate::{c_str::CStr, platform::types::*};
#[no_mangle] #[no_mangle]
...@@ -9,9 +12,9 @@ pub unsafe extern "C" fn __assert_fail( ...@@ -9,9 +12,9 @@ pub unsafe extern "C" fn __assert_fail(
line: c_int, line: c_int,
cond: *const c_char, cond: *const c_char,
) -> ! { ) -> ! {
let func = CStr::from_ptr(func).to_str().unwrap(); let func = unsafe { CStr::from_ptr(func) }.to_str().unwrap();
let file = CStr::from_ptr(file).to_str().unwrap(); let file = unsafe { CStr::from_ptr(file) }.to_str().unwrap();
let cond = CStr::from_ptr(cond).to_str().unwrap(); let cond = unsafe { CStr::from_ptr(cond) }.to_str().unwrap();
eprintln!("{}: {}:{}: Assertion `{}` failed.", func, file, line, cond); eprintln!("{}: {}:{}: Assertion `{}` failed.", func, file, line, cond);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment