File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 126
126
#![ feature( auto_traits) ]
127
127
#![ feature( or_patterns) ]
128
128
#![ feature( prelude_import) ]
129
+ #![ feature( raw_ref_macros) ]
129
130
#![ feature( repr_simd, platform_intrinsics) ]
130
131
#![ feature( rustc_attrs) ]
131
132
#![ feature( simd_ffi) ]
Original file line number Diff line number Diff line change @@ -542,10 +542,9 @@ impl<T> [T] {
542
542
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
543
543
#[ inline]
544
544
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] ) ;
549
548
// SAFETY: `pa` and `pb` have been created from safe mutable references and refer
550
549
// to elements in the slice and therefore are guaranteed to be valid and aligned.
551
550
// 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