From 153de4c5d9e7846a029f9c79fb9940f72f5961f9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jun 2015 18:03:13 -0700 Subject: [PATCH] std: Deprecate the copy_{,mut_}lifetime functions Unsafe patterns such as `slice::from_raw_parts` and `CStr::from_ptr` have shown that dealing with lifetimes, while useful, is often a hindrance. Consequently these functions are rarely called today and are being deprecated. --- src/libcore/mem.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 4e9613454ab..15e7cdbde40 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -462,6 +462,10 @@ pub unsafe fn transmute_copy(src: &T) -> U { #[unstable(feature = "copy_lifetime", reason = "this function may be removed in the future due to its \ questionable utility")] +#[deprecated(since = "1.2.0", + reason = "unclear that this function buys more safety and \ + lifetimes are generally not handled as such in unsafe \ + code today")] pub unsafe fn copy_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a S, ptr: &T) -> &'a T { transmute(ptr) @@ -472,6 +476,10 @@ pub unsafe fn copy_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a S, #[unstable(feature = "copy_lifetime", reason = "this function may be removed in the future due to its \ questionable utility")] +#[deprecated(since = "1.2.0", + reason = "unclear that this function buys more safety and \ + lifetimes are generally not handled as such in unsafe \ + code today")] pub unsafe fn copy_mut_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a S, ptr: &mut T) -> &'a mut T