11
11
{
12
12
type Output = I :: Output ;
13
13
14
- #[ inline( always) ]
14
+ #[ cfg_attr( bootstrap, inline( always) ) ]
15
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
15
16
fn index ( & self , index : I ) -> & I :: Output {
16
17
index. index ( self )
17
18
}
@@ -22,7 +23,8 @@ impl<T, I> ops::IndexMut<I> for [T]
22
23
where
23
24
I : SliceIndex < [ T ] > ,
24
25
{
25
- #[ inline( always) ]
26
+ #[ cfg_attr( bootstrap, inline( always) ) ]
27
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
26
28
fn index_mut ( & mut self , index : I ) -> & mut I :: Output {
27
29
index. index_mut ( self )
28
30
}
@@ -455,7 +457,8 @@ unsafe impl<T> SliceIndex<[T]> for ops::Range<usize> {
455
457
}
456
458
}
457
459
458
- #[ inline( always) ]
460
+ #[ cfg_attr( bootstrap, inline( always) ) ]
461
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
459
462
fn index ( self , slice : & [ T ] ) -> & [ T ] {
460
463
// Using checked_sub is a safe way to get `SubUnchecked` in MIR
461
464
let Some ( new_len) = usize:: checked_sub ( self . end , self . start ) else {
@@ -507,7 +510,8 @@ unsafe impl<T> SliceIndex<[T]> for range::Range<usize> {
507
510
unsafe { ops:: Range :: from ( self ) . get_unchecked_mut ( slice) }
508
511
}
509
512
510
- #[ inline( always) ]
513
+ #[ cfg_attr( bootstrap, inline( always) ) ]
514
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
511
515
fn index ( self , slice : & [ T ] ) -> & [ T ] {
512
516
ops:: Range :: from ( self ) . index ( slice)
513
517
}
@@ -545,7 +549,8 @@ unsafe impl<T> SliceIndex<[T]> for ops::RangeTo<usize> {
545
549
unsafe { ( 0 ..self . end ) . get_unchecked_mut ( slice) }
546
550
}
547
551
548
- #[ inline( always) ]
552
+ #[ cfg_attr( bootstrap, inline( always) ) ]
553
+ #[ cfg_attr( not( bootstrap) , inline( usually) ) ]
549
554
fn index ( self , slice : & [ T ] ) -> & [ T ] {
550
555
( 0 ..self . end ) . index ( slice)
551
556
}
0 commit comments