File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 126126#![ feature( auto_traits) ]
127127#![ feature( or_patterns) ]
128128#![ feature( prelude_import) ]
129+ #![ feature( raw_ref_macros) ]
129130#![ feature( repr_simd, platform_intrinsics) ]
130131#![ feature( rustc_attrs) ]
131132#![ feature( simd_ffi) ]
Original file line number Diff line number Diff line change @@ -542,10 +542,9 @@ impl<T> [T] {
542542 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
543543 #[ inline]
544544 pub fn swap ( & mut self , a : usize , b : usize ) {
545- // Can't take two mutable loans from one vector, so instead just cast
546- // them to their raw pointers to do the swap.
547- let pa: * mut T = & mut self [ a] ;
548- let pb: * mut T = & mut self [ b] ;
545+ // Can't take two mutable loans from one vector, so instead use raw pointers.
546+ let pa = ptr:: raw_mut!( self [ a] ) ;
547+ let pb = ptr:: raw_mut!( self [ b] ) ;
549548 // SAFETY: `pa` and `pb` have been created from safe mutable references and refer
550549 // to elements in the slice and therefore are guaranteed to be valid and aligned.
551550 // Note that accessing the elements behind `a` and `b` is checked and will
You can’t perform that action at this time.
0 commit comments