@@ -65,7 +65,7 @@ macro_rules! index_impls {
65
65
// Always PyAny output (even if the slice operation returns something else)
66
66
type Output = PyAny ;
67
67
68
- #[ cfg_attr ( track_caller, track_caller ) ]
68
+ #[ track_caller]
69
69
fn index( & self , index: usize ) -> & Self :: Output {
70
70
self . get_item( index) . unwrap_or_else( |_| {
71
71
crate :: internal_tricks:: index_len_fail( index, $ty_name, $len( self ) )
@@ -76,7 +76,7 @@ macro_rules! index_impls {
76
76
impl std:: ops:: Index <std:: ops:: Range <usize >> for $ty {
77
77
type Output = $ty;
78
78
79
- #[ cfg_attr ( track_caller, track_caller ) ]
79
+ #[ track_caller]
80
80
fn index(
81
81
& self ,
82
82
std:: ops:: Range { start, end } : std:: ops:: Range <usize >,
@@ -97,7 +97,7 @@ macro_rules! index_impls {
97
97
impl std:: ops:: Index <std:: ops:: RangeFrom <usize >> for $ty {
98
98
type Output = $ty;
99
99
100
- #[ cfg_attr ( track_caller, track_caller ) ]
100
+ #[ track_caller]
101
101
fn index(
102
102
& self ,
103
103
std:: ops:: RangeFrom { start } : std:: ops:: RangeFrom <usize >,
@@ -114,7 +114,7 @@ macro_rules! index_impls {
114
114
impl std:: ops:: Index <std:: ops:: RangeFull > for $ty {
115
115
type Output = $ty;
116
116
117
- #[ cfg_attr ( track_caller, track_caller ) ]
117
+ #[ track_caller]
118
118
fn index( & self , _: std:: ops:: RangeFull ) -> & Self :: Output {
119
119
let len = $len( self ) ;
120
120
$get_slice( self , 0 , len)
@@ -124,7 +124,7 @@ macro_rules! index_impls {
124
124
impl std:: ops:: Index <std:: ops:: RangeInclusive <usize >> for $ty {
125
125
type Output = $ty;
126
126
127
- #[ cfg_attr ( track_caller, track_caller ) ]
127
+ #[ track_caller]
128
128
fn index( & self , range: std:: ops:: RangeInclusive <usize >) -> & Self :: Output {
129
129
let exclusive_end = range
130
130
. end( )
@@ -137,7 +137,7 @@ macro_rules! index_impls {
137
137
impl std:: ops:: Index <std:: ops:: RangeTo <usize >> for $ty {
138
138
type Output = $ty;
139
139
140
- #[ cfg_attr ( track_caller, track_caller ) ]
140
+ #[ track_caller]
141
141
fn index( & self , std:: ops:: RangeTo { end } : std:: ops:: RangeTo <usize >) -> & Self :: Output {
142
142
& self [ 0 ..end]
143
143
}
@@ -146,7 +146,7 @@ macro_rules! index_impls {
146
146
impl std:: ops:: Index <std:: ops:: RangeToInclusive <usize >> for $ty {
147
147
type Output = $ty;
148
148
149
- #[ cfg_attr ( track_caller, track_caller ) ]
149
+ #[ track_caller]
150
150
fn index(
151
151
& self ,
152
152
std:: ops:: RangeToInclusive { end } : std:: ops:: RangeToInclusive <usize >,
@@ -161,7 +161,7 @@ macro_rules! index_impls {
161
161
162
162
#[ inline( never) ]
163
163
#[ cold]
164
- #[ cfg_attr ( track_caller, track_caller ) ]
164
+ #[ track_caller]
165
165
pub ( crate ) fn index_len_fail ( index : usize , ty_name : & str , len : usize ) -> ! {
166
166
panic ! (
167
167
"index {} out of range for {} of length {}" ,
@@ -171,7 +171,7 @@ pub(crate) fn index_len_fail(index: usize, ty_name: &str, len: usize) -> ! {
171
171
172
172
#[ inline( never) ]
173
173
#[ cold]
174
- #[ cfg_attr ( track_caller, track_caller ) ]
174
+ #[ track_caller]
175
175
pub ( crate ) fn slice_start_index_len_fail ( index : usize , ty_name : & str , len : usize ) -> ! {
176
176
panic ! (
177
177
"range start index {} out of range for {} of length {}" ,
@@ -181,7 +181,7 @@ pub(crate) fn slice_start_index_len_fail(index: usize, ty_name: &str, len: usize
181
181
182
182
#[ inline( never) ]
183
183
#[ cold]
184
- #[ cfg_attr ( track_caller, track_caller ) ]
184
+ #[ track_caller]
185
185
pub ( crate ) fn slice_end_index_len_fail ( index : usize , ty_name : & str , len : usize ) -> ! {
186
186
panic ! (
187
187
"range end index {} out of range for {} of length {}" ,
@@ -191,7 +191,7 @@ pub(crate) fn slice_end_index_len_fail(index: usize, ty_name: &str, len: usize)
191
191
192
192
#[ inline( never) ]
193
193
#[ cold]
194
- #[ cfg_attr ( track_caller, track_caller ) ]
194
+ #[ track_caller]
195
195
pub ( crate ) fn slice_index_order_fail ( index : usize , end : usize ) -> ! {
196
196
panic ! ( "slice index starts at {} but ends at {}" , index, end) ;
197
197
}
0 commit comments