Skip to content

Commit f82aef7

Browse files
Document the safety requirements of rust_fmt_argument
1 parent 68821be commit f82aef7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rust/kernel/print.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ use core::fmt;
1212
use crate::bindings;
1313
use crate::c_types::{c_char, c_void};
1414

15-
// Called from `vsprintf` with format specifier `%pA`.
15+
/// Called from `vsprintf` with format specifier `%pA`.
16+
///
17+
/// # Safety
18+
///
19+
/// The region between `buf` and `end` must be valid for writes.
20+
/// `ptr` must point to a valid instance of `fmt::Arguments`.
1621
#[no_mangle]
1722
unsafe fn rust_fmt_argument(buf: *mut c_char, end: *mut c_char, ptr: *const c_void) -> *mut c_char {
1823
use fmt::Write;

0 commit comments

Comments
 (0)