Skip to content

Commit 38b6156

Browse files
committed
Update UI tests
1 parent 7a88896 commit 38b6156

File tree

3 files changed

+31
-45
lines changed

3 files changed

+31
-45
lines changed

tests/ui/indexing_slicing.stderr

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
error: index out of bounds: the len is 4 but the index is 4
2-
--> $DIR/indexing_slicing.rs:19:5
2+
--> $DIR/indexing_slicing.rs:18:5
33
|
44
LL | x[4]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
55
| ^^^^
66
|
77
= note: #[deny(const_err)] on by default
88

99
error: index out of bounds: the len is 4 but the index is 8
10-
--> $DIR/indexing_slicing.rs:20:5
10+
--> $DIR/indexing_slicing.rs:19:5
1111
|
1212
LL | x[1 << 3]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
1313
| ^^^^^^^^^
1414

1515
error: index out of bounds: the len is 4 but the index is 15
16-
--> $DIR/indexing_slicing.rs:55:5
16+
--> $DIR/indexing_slicing.rs:54:5
1717
|
1818
LL | x[N]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
1919
| ^^^^
2020

2121
error: indexing may panic.
22-
--> $DIR/indexing_slicing.rs:14:5
22+
--> $DIR/indexing_slicing.rs:13:5
2323
|
2424
LL | x[index];
2525
| ^^^^^^^^
@@ -28,181 +28,181 @@ LL | x[index];
2828
= help: Consider using `.get(n)` or `.get_mut(n)` instead
2929

3030
error: slicing may panic.
31-
--> $DIR/indexing_slicing.rs:15:6
31+
--> $DIR/indexing_slicing.rs:14:6
3232
|
3333
LL | &x[index..];
3434
| ^^^^^^^^^^
3535
|
3636
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
3737

3838
error: slicing may panic.
39-
--> $DIR/indexing_slicing.rs:16:6
39+
--> $DIR/indexing_slicing.rs:15:6
4040
|
4141
LL | &x[..index];
4242
| ^^^^^^^^^^
4343
|
4444
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
4545

4646
error: slicing may panic.
47-
--> $DIR/indexing_slicing.rs:17:6
47+
--> $DIR/indexing_slicing.rs:16:6
4848
|
4949
LL | &x[index_from..index_to];
5050
| ^^^^^^^^^^^^^^^^^^^^^^^
5151
|
5252
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
5353

5454
error: slicing may panic.
55-
--> $DIR/indexing_slicing.rs:18:6
55+
--> $DIR/indexing_slicing.rs:17:6
5656
|
5757
LL | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
5858
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
5959
|
6060
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
6161

6262
error: slicing may panic.
63-
--> $DIR/indexing_slicing.rs:18:6
63+
--> $DIR/indexing_slicing.rs:17:6
6464
|
6565
LL | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
6666
| ^^^^^^^^^^^^^^^
6767
|
6868
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
6969

7070
error: slicing may panic.
71-
--> $DIR/indexing_slicing.rs:21:6
71+
--> $DIR/indexing_slicing.rs:20:6
7272
|
7373
LL | &x[5..][..10]; // Two lint reports, one for out of bounds [5..] and another for slicing [..10].
7474
| ^^^^^^^^^^^^
7575
|
7676
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
7777

7878
error: range is out of bounds
79-
--> $DIR/indexing_slicing.rs:21:8
79+
--> $DIR/indexing_slicing.rs:20:8
8080
|
8181
LL | &x[5..][..10]; // Two lint reports, one for out of bounds [5..] and another for slicing [..10].
8282
| ^
8383
|
8484
= note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings`
8585

8686
error: slicing may panic.
87-
--> $DIR/indexing_slicing.rs:22:6
87+
--> $DIR/indexing_slicing.rs:21:6
8888
|
8989
LL | &x[0..][..3];
9090
| ^^^^^^^^^^^
9191
|
9292
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
9393

9494
error: slicing may panic.
95-
--> $DIR/indexing_slicing.rs:23:6
95+
--> $DIR/indexing_slicing.rs:22:6
9696
|
9797
LL | &x[1..][..5];
9898
| ^^^^^^^^^^^
9999
|
100100
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
101101

102102
error: indexing may panic.
103-
--> $DIR/indexing_slicing.rs:31:5
103+
--> $DIR/indexing_slicing.rs:30:5
104104
|
105105
LL | y[0];
106106
| ^^^^
107107
|
108108
= help: Consider using `.get(n)` or `.get_mut(n)` instead
109109

110110
error: slicing may panic.
111-
--> $DIR/indexing_slicing.rs:32:6
111+
--> $DIR/indexing_slicing.rs:31:6
112112
|
113113
LL | &y[1..2];
114114
| ^^^^^^^
115115
|
116116
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
117117

118118
error: slicing may panic.
119-
--> $DIR/indexing_slicing.rs:33:6
119+
--> $DIR/indexing_slicing.rs:32:6
120120
|
121121
LL | &y[0..=4];
122122
| ^^^^^^^^
123123
|
124124
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
125125

126126
error: slicing may panic.
127-
--> $DIR/indexing_slicing.rs:34:6
127+
--> $DIR/indexing_slicing.rs:33:6
128128
|
129129
LL | &y[..=4];
130130
| ^^^^^^^
131131
|
132132
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
133133

134134
error: indexing may panic.
135-
--> $DIR/indexing_slicing.rs:39:5
135+
--> $DIR/indexing_slicing.rs:38:5
136136
|
137137
LL | v[0];
138138
| ^^^^
139139
|
140140
= help: Consider using `.get(n)` or `.get_mut(n)` instead
141141

142142
error: indexing may panic.
143-
--> $DIR/indexing_slicing.rs:40:5
143+
--> $DIR/indexing_slicing.rs:39:5
144144
|
145145
LL | v[10];
146146
| ^^^^^
147147
|
148148
= help: Consider using `.get(n)` or `.get_mut(n)` instead
149149

150150
error: indexing may panic.
151-
--> $DIR/indexing_slicing.rs:41:5
151+
--> $DIR/indexing_slicing.rs:40:5
152152
|
153153
LL | v[1 << 3];
154154
| ^^^^^^^^^
155155
|
156156
= help: Consider using `.get(n)` or `.get_mut(n)` instead
157157

158158
error: slicing may panic.
159-
--> $DIR/indexing_slicing.rs:42:6
159+
--> $DIR/indexing_slicing.rs:41:6
160160
|
161161
LL | &v[10..100];
162162
| ^^^^^^^^^^
163163
|
164164
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
165165

166166
error: slicing may panic.
167-
--> $DIR/indexing_slicing.rs:43:6
167+
--> $DIR/indexing_slicing.rs:42:6
168168
|
169169
LL | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
170170
| ^^^^^^^^^^^^^^
171171
|
172172
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
173173

174174
error: range is out of bounds
175-
--> $DIR/indexing_slicing.rs:43:8
175+
--> $DIR/indexing_slicing.rs:42:8
176176
|
177177
LL | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
178178
| ^^
179179

180180
error: slicing may panic.
181-
--> $DIR/indexing_slicing.rs:44:6
181+
--> $DIR/indexing_slicing.rs:43:6
182182
|
183183
LL | &v[10..];
184184
| ^^^^^^^
185185
|
186186
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
187187

188188
error: slicing may panic.
189-
--> $DIR/indexing_slicing.rs:45:6
189+
--> $DIR/indexing_slicing.rs:44:6
190190
|
191191
LL | &v[..100];
192192
| ^^^^^^^^
193193
|
194194
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
195195

196196
error: indexing may panic.
197-
--> $DIR/indexing_slicing.rs:57:5
197+
--> $DIR/indexing_slicing.rs:56:5
198198
|
199199
LL | v[N];
200200
| ^^^^
201201
|
202202
= help: Consider using `.get(n)` or `.get_mut(n)` instead
203203

204204
error: indexing may panic.
205-
--> $DIR/indexing_slicing.rs:58:5
205+
--> $DIR/indexing_slicing.rs:57:5
206206
|
207207
LL | v[M];
208208
| ^^^^

tests/ui/out_of_bounds_indexing/empty_array.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: index out of bounds: the len is 0 but the index is 0
22
--> $DIR/empty_array.rs:6:5
33
|
4-
LL | empty[0]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
4+
LL | empty[0];
55
| ^^^^^^^^
66
|
77
= note: #[deny(const_err)] on by default
Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
1-
error: statement with no effect
2-
--> $DIR/issue-3102.rs:8:5
3-
|
4-
LL | &x[num..10]; // should trigger out of bounds error
5-
| ^^^^^^^^^^^^
6-
|
7-
= note: `-D clippy::no-effect` implied by `-D warnings`
8-
91
error: range is out of bounds
10-
--> $DIR/issue-3102.rs:8:13
2+
--> $DIR/issue-3102.rs:9:13
113
|
124
LL | &x[num..10]; // should trigger out of bounds error
135
| ^^
146
|
157
= note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings`
168

17-
error: statement with no effect
18-
--> $DIR/issue-3102.rs:9:5
19-
|
20-
LL | &x[10..num]; // should trigger out of bounds error
21-
| ^^^^^^^^^^^^
22-
239
error: range is out of bounds
24-
--> $DIR/issue-3102.rs:9:8
10+
--> $DIR/issue-3102.rs:10:8
2511
|
2612
LL | &x[10..num]; // should trigger out of bounds error
2713
| ^^
2814

29-
error: aborting due to 4 previous errors
15+
error: aborting due to 2 previous errors
3016

0 commit comments

Comments
 (0)