Rollup merge of #130101 - RalfJung:const-cleanup, r=fee1-dead · qinheping/verify-rust-std@ac68273 (original) (raw)
`@@ -31,12 +31,12 @@ where
`
31
31
`#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold)]
`
32
32
`#[cfg_attr(feature = "panic_immediate_abort", inline)]
`
33
33
`#[track_caller]
`
34
``
`-
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
`
35
34
`const fn slice_start_index_len_fail(index: usize, len: usize) -> ! {
`
``
35
`+
// FIXME(const-hack): once integer formatting in panics is possible, we
`
``
36
`+
// should use the same implementation at compiletime and runtime.
`
36
37
`const_eval_select((index, len), slice_start_index_len_fail_ct, slice_start_index_len_fail_rt)
`
37
38
`}
`
38
39
``
39
``
`-
// FIXME const-hack
`
40
40
`#[inline]
`
41
41
`#[track_caller]
`
42
42
`fn slice_start_index_len_fail_rt(index: usize, len: usize) -> ! {
`
`@@ -52,12 +52,12 @@ const fn slice_start_index_len_fail_ct(_: usize, _: usize) -> ! {
`
52
52
`#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold)]
`
53
53
`#[cfg_attr(feature = "panic_immediate_abort", inline)]
`
54
54
`#[track_caller]
`
55
``
`-
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
`
56
55
`const fn slice_end_index_len_fail(index: usize, len: usize) -> ! {
`
``
56
`+
// FIXME(const-hack): once integer formatting in panics is possible, we
`
``
57
`+
// should use the same implementation at compiletime and runtime.
`
57
58
`const_eval_select((index, len), slice_end_index_len_fail_ct, slice_end_index_len_fail_rt)
`
58
59
`}
`
59
60
``
60
``
`-
// FIXME const-hack
`
61
61
`#[inline]
`
62
62
`#[track_caller]
`
63
63
`fn slice_end_index_len_fail_rt(index: usize, len: usize) -> ! {
`
`@@ -73,12 +73,12 @@ const fn slice_end_index_len_fail_ct(_: usize, _: usize) -> ! {
`
73
73
`#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold)]
`
74
74
`#[cfg_attr(feature = "panic_immediate_abort", inline)]
`
75
75
`#[track_caller]
`
76
``
`-
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
`
77
76
`const fn slice_index_order_fail(index: usize, end: usize) -> ! {
`
``
77
`+
// FIXME(const-hack): once integer formatting in panics is possible, we
`
``
78
`+
// should use the same implementation at compiletime and runtime.
`
78
79
`const_eval_select((index, end), slice_index_order_fail_ct, slice_index_order_fail_rt)
`
79
80
`}
`
80
81
``
81
``
`-
// FIXME const-hack
`
82
82
`#[inline]
`
83
83
`#[track_caller]
`
84
84
`fn slice_index_order_fail_rt(index: usize, end: usize) -> ! {
`
`@@ -246,7 +246,6 @@ pub unsafe trait SliceIndex<T: ?Sized>: private_slice_index::Sealed {
`
246
246
``
247
247
`` /// The methods index
and index_mut
panic if the index is out of bounds.
``
248
248
`#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
`
249
``
`-
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
`
250
249
`unsafe impl SliceIndex<[T]> for usize {
`
251
250
`type Output = T;
`
252
251
``
`@@ -386,7 +385,6 @@ unsafe impl SliceIndex<[T]> for ops::IndexRange {
`
386
385
`/// - the start of the range is greater than the end of the range or
`
387
386
`/// - the end of the range is out of bounds.
`
388
387
`#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
`
389
``
`-
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
`
390
388
`unsafe impl SliceIndex<[T]> for ops::Range {
`
391
389
`type Output = [T];
`
392
390
``
`@@ -522,7 +520,6 @@ unsafe impl SliceIndex<[T]> for range::Range {
`
522
520
``
523
521
`` /// The methods index
and index_mut
panic if the end of the range is out of bounds.
``
524
522
`#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
`
525
``
`-
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
`
526
523
`unsafe impl SliceIndex<[T]> for ops::RangeTo {
`
527
524
`type Output = [T];
`
528
525
``
`@@ -561,7 +558,6 @@ unsafe impl SliceIndex<[T]> for ops::RangeTo {
`
561
558
``
562
559
`` /// The methods index
and index_mut
panic if the start of the range is out of bounds.
``
563
560
`#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
`
564
``
`-
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
`
565
561
`unsafe impl SliceIndex<[T]> for ops::RangeFrom {
`
566
562
`type Output = [T];
`
567
563
``
`@@ -644,7 +640,6 @@ unsafe impl SliceIndex<[T]> for range::RangeFrom {
`
644
640
`}
`
645
641
``
646
642
`#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
`
647
``
`-
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
`
648
643
`unsafe impl SliceIndex<[T]> for ops::RangeFull {
`
649
644
`type Output = [T];
`
650
645
``
`@@ -684,7 +679,6 @@ unsafe impl SliceIndex<[T]> for ops::RangeFull {
`
684
679
`/// - the start of the range is greater than the end of the range or
`
685
680
`/// - the end of the range is out of bounds.
`
686
681
`#[stable(feature = "inclusive_range", since = "1.26.0")]
`
687
``
`-
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
`
688
682
`unsafe impl SliceIndex<[T]> for ops::RangeInclusive {
`
689
683
`type Output = [T];
`
690
684
``
`@@ -766,7 +760,6 @@ unsafe impl SliceIndex<[T]> for range::RangeInclusive {
`
766
760
``
767
761
`` /// The methods index
and index_mut
panic if the end of the range is out of bounds.
``
768
762
`#[stable(feature = "inclusive_range", since = "1.26.0")]
`
769
``
`-
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
`
770
763
`unsafe impl SliceIndex<[T]> for ops::RangeToInclusive {
`
771
764
`type Output = [T];
`
772
765
``