Skip to content

Commit 023a931

Browse files
committed
Make the lifetime anchor immutable on std::mem::copy_mut_lifetime
Only the second reference's mutability is relevant to the mutability of the returned reference.
1 parent 2c05354 commit 023a931

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/libcore/mem.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,9 @@ pub unsafe fn copy_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a S,
331331
#[unstable(feature = "core",
332332
reason = "this function may be removed in the future due to its \
333333
questionable utility")]
334-
pub unsafe fn copy_mut_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a mut S,
335-
ptr: &mut T)
336-
-> &'a mut T {
334+
pub unsafe fn copy_mut_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a S,
335+
ptr: &mut T)
336+
-> &'a mut T
337+
{
337338
transmute(ptr)
338339
}

0 commit comments

Comments
 (0)