1
Fork 0

Use the "Safety" heading instead of "Undefined Behavior"

This commit is contained in:
Dylan MacKenzie 2018-05-09 14:14:43 -07:00
parent d7209d5bab
commit e350ba48ed
2 changed files with 9 additions and 65 deletions

View file

@ -54,11 +54,6 @@ pub use intrinsics::write_bytes;
///
/// # Safety
///
/// `drop_in_place` is unsafe because it dereferences a raw pointer. The caller
/// must ensure that the pointer points to a valid value of type `T`.
///
/// # Undefined Behavior
///
/// Behavior is undefined if any of the following conditions are violated:
///
/// * `to_drop` must point to valid memory.
@ -153,11 +148,6 @@ pub const fn null_mut<T>() -> *mut T { 0 as *mut T }
///
/// # Safety
///
/// `swap` is unsafe because it dereferences a raw pointer. The caller must
/// ensure that both pointers point to valid values of type `T`.
///
/// # Undefined Behavior
///
/// Behavior is undefined if any of the following conditions are violated:
///
/// * `x` and `y` must point to valid, initialized memory.
@ -307,14 +297,9 @@ unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) {
/// operates on raw pointers instead of references. When references are
/// available, [`mem::replace`] should be preferred.
///
/// # Safety
///
/// `replace` is unsafe because it dereferences a raw pointer. The caller
/// must ensure that the pointer points to a valid value of type `T`.
///
/// [`mem::replace`]: ../mem/fn.replace.html
///
/// # Undefined Behavior
/// # Safety
///
/// Behavior is undefined if any of the following conditions are violated:
///
@ -350,11 +335,6 @@ pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
///
/// # Safety
///
/// `read` is unsafe because it dereferences a raw pointer. The caller
/// must ensure that the pointer points to a valid value of type `T`.
///
/// # Undefined Behavior
///
/// Behavior is undefined if any of the following conditions are violated:
///
/// * `src` must point to valid, initialized memory.
@ -440,11 +420,6 @@ pub unsafe fn read<T>(src: *const T) -> T {
///
/// # Safety
///
/// `read_unaligned` is unsafe because it dereferences a raw pointer. The caller
/// must ensure that the pointer points to a valid value of type `T`.
///
/// # Undefined Behavior
///
/// Behavior is undefined if any of the following conditions are violated:
///
/// * `src` must point to valid, initialized memory.
@ -523,10 +498,6 @@ pub unsafe fn read_unaligned<T>(src: *const T) -> T {
///
/// # Safety
///
/// `write` is unsafe because it dereferences a raw pointer.
///
/// # Undefined Behavior
///
/// Behavior is undefined if any of the following conditions are violated:
///
/// * `dst` must point to valid memory.
@ -600,10 +571,6 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
///
/// # Safety
///
/// `write_unaligned` is unsafe because it dereferences a raw pointer.
///
/// # Undefined Behavior
///
/// Behavior is undefined if any of the following conditions are violated:
///
/// * `dst` must point to valid memory.
@ -671,11 +638,6 @@ pub unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
///
/// # Safety
///
/// `read_volatile` is unsafe because it dereferences a raw pointer. The caller
/// must ensure that the pointer points to a valid value of type `T`.
///
/// # Undefined Behavior
///
/// Behavior is undefined if any of the following conditions are violated:
///
/// * `src` must point to valid, initialized memory.
@ -741,10 +703,6 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T {
///
/// # Safety
///
/// `write_volatile` is unsafe because it dereferences a raw pointer.
///
/// # Undefined Behavior
///
/// Behavior is undefined if any of the following conditions are violated:
///
/// * `dst` must point to valid memory.