Skip to content

Commit 8a6831a

Browse files
committed
Say "doesn't" instead of "wouldn't" in convert message
1 parent 094f14c commit 8a6831a

18 files changed

+176
-176
lines changed

compiler/rustc_typeck/src/check/demand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
827827
let suggestion = format!("{}::from({})", checked_ty, lhs_src);
828828
(lhs_expr.span, msg, suggestion)
829829
} else {
830-
let msg = format!("{} and panic if the converted value wouldn't fit", msg);
830+
let msg = format!("{} and panic if the converted value doesn't fit", msg);
831831
let suggestion =
832832
format!("{}{}.try_into().unwrap()", prefix, with_opt_paren(&src));
833833
(expr.span, msg, suggestion)

src/test/ui/associated-types/associated-types-path-2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ LL | let _: i32 = f2(2i32);
4747
| |
4848
| expected due to this
4949
|
50-
help: you can convert a `u32` to an `i32` and panic if the converted value wouldn't fit
50+
help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
5151
|
5252
LL | let _: i32 = f2(2i32).try_into().unwrap();
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/indexing-requires-a-uint.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ error[E0308]: mismatched types
1313
LL | bar::<isize>(i); // i should not be re-coerced back to an isize
1414
| ^ expected `isize`, found `usize`
1515
|
16-
help: you can convert a `usize` to an `isize` and panic if the converted value wouldn't fit
16+
help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
1717
|
1818
LL | bar::<isize>(i.try_into().unwrap()); // i should not be re-coerced back to an isize
1919
| ^^^^^^^^^^^^^^^^^^^^^

src/test/ui/integer-literal-suffix-inference.stderr

+30-30
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
44
LL | id_i8(a16);
55
| ^^^ expected `i8`, found `i16`
66
|
7-
help: you can convert an `i16` to an `i8` and panic if the converted value wouldn't fit
7+
help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit
88
|
99
LL | id_i8(a16.try_into().unwrap());
1010
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -15,7 +15,7 @@ error[E0308]: mismatched types
1515
LL | id_i8(a32);
1616
| ^^^ expected `i8`, found `i32`
1717
|
18-
help: you can convert an `i32` to an `i8` and panic if the converted value wouldn't fit
18+
help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
1919
|
2020
LL | id_i8(a32.try_into().unwrap());
2121
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -26,7 +26,7 @@ error[E0308]: mismatched types
2626
LL | id_i8(a64);
2727
| ^^^ expected `i8`, found `i64`
2828
|
29-
help: you can convert an `i64` to an `i8` and panic if the converted value wouldn't fit
29+
help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit
3030
|
3131
LL | id_i8(a64.try_into().unwrap());
3232
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -37,7 +37,7 @@ error[E0308]: mismatched types
3737
LL | id_i8(asize);
3838
| ^^^^^ expected `i8`, found `isize`
3939
|
40-
help: you can convert an `isize` to an `i8` and panic if the converted value wouldn't fit
40+
help: you can convert an `isize` to an `i8` and panic if the converted value doesn't fit
4141
|
4242
LL | id_i8(asize.try_into().unwrap());
4343
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -57,7 +57,7 @@ error[E0308]: mismatched types
5757
LL | id_i16(a32);
5858
| ^^^ expected `i16`, found `i32`
5959
|
60-
help: you can convert an `i32` to an `i16` and panic if the converted value wouldn't fit
60+
help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit
6161
|
6262
LL | id_i16(a32.try_into().unwrap());
6363
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -68,7 +68,7 @@ error[E0308]: mismatched types
6868
LL | id_i16(a64);
6969
| ^^^ expected `i16`, found `i64`
7070
|
71-
help: you can convert an `i64` to an `i16` and panic if the converted value wouldn't fit
71+
help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit
7272
|
7373
LL | id_i16(a64.try_into().unwrap());
7474
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -79,7 +79,7 @@ error[E0308]: mismatched types
7979
LL | id_i16(asize);
8080
| ^^^^^ expected `i16`, found `isize`
8181
|
82-
help: you can convert an `isize` to an `i16` and panic if the converted value wouldn't fit
82+
help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit
8383
|
8484
LL | id_i16(asize.try_into().unwrap());
8585
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -108,7 +108,7 @@ error[E0308]: mismatched types
108108
LL | id_i32(a64);
109109
| ^^^ expected `i32`, found `i64`
110110
|
111-
help: you can convert an `i64` to an `i32` and panic if the converted value wouldn't fit
111+
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
112112
|
113113
LL | id_i32(a64.try_into().unwrap());
114114
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -119,7 +119,7 @@ error[E0308]: mismatched types
119119
LL | id_i32(asize);
120120
| ^^^^^ expected `i32`, found `isize`
121121
|
122-
help: you can convert an `isize` to an `i32` and panic if the converted value wouldn't fit
122+
help: you can convert an `isize` to an `i32` and panic if the converted value doesn't fit
123123
|
124124
LL | id_i32(asize.try_into().unwrap());
125125
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -157,7 +157,7 @@ error[E0308]: mismatched types
157157
LL | id_i64(asize);
158158
| ^^^^^ expected `i64`, found `isize`
159159
|
160-
help: you can convert an `isize` to an `i64` and panic if the converted value wouldn't fit
160+
help: you can convert an `isize` to an `i64` and panic if the converted value doesn't fit
161161
|
162162
LL | id_i64(asize.try_into().unwrap());
163163
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -186,7 +186,7 @@ error[E0308]: mismatched types
186186
LL | id_isize(a32);
187187
| ^^^ expected `isize`, found `i32`
188188
|
189-
help: you can convert an `i32` to an `isize` and panic if the converted value wouldn't fit
189+
help: you can convert an `i32` to an `isize` and panic if the converted value doesn't fit
190190
|
191191
LL | id_isize(a32.try_into().unwrap());
192192
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -197,7 +197,7 @@ error[E0308]: mismatched types
197197
LL | id_isize(a64);
198198
| ^^^ expected `isize`, found `i64`
199199
|
200-
help: you can convert an `i64` to an `isize` and panic if the converted value wouldn't fit
200+
help: you can convert an `i64` to an `isize` and panic if the converted value doesn't fit
201201
|
202202
LL | id_isize(a64.try_into().unwrap());
203203
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -208,7 +208,7 @@ error[E0308]: mismatched types
208208
LL | id_i8(c16);
209209
| ^^^ expected `i8`, found `i16`
210210
|
211-
help: you can convert an `i16` to an `i8` and panic if the converted value wouldn't fit
211+
help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit
212212
|
213213
LL | id_i8(c16.try_into().unwrap());
214214
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -219,7 +219,7 @@ error[E0308]: mismatched types
219219
LL | id_i8(c32);
220220
| ^^^ expected `i8`, found `i32`
221221
|
222-
help: you can convert an `i32` to an `i8` and panic if the converted value wouldn't fit
222+
help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
223223
|
224224
LL | id_i8(c32.try_into().unwrap());
225225
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -230,7 +230,7 @@ error[E0308]: mismatched types
230230
LL | id_i8(c64);
231231
| ^^^ expected `i8`, found `i64`
232232
|
233-
help: you can convert an `i64` to an `i8` and panic if the converted value wouldn't fit
233+
help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit
234234
|
235235
LL | id_i8(c64.try_into().unwrap());
236236
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -250,7 +250,7 @@ error[E0308]: mismatched types
250250
LL | id_i16(c32);
251251
| ^^^ expected `i16`, found `i32`
252252
|
253-
help: you can convert an `i32` to an `i16` and panic if the converted value wouldn't fit
253+
help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit
254254
|
255255
LL | id_i16(c32.try_into().unwrap());
256256
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -261,7 +261,7 @@ error[E0308]: mismatched types
261261
LL | id_i16(c64);
262262
| ^^^ expected `i16`, found `i64`
263263
|
264-
help: you can convert an `i64` to an `i16` and panic if the converted value wouldn't fit
264+
help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit
265265
|
266266
LL | id_i16(c64.try_into().unwrap());
267267
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -290,7 +290,7 @@ error[E0308]: mismatched types
290290
LL | id_i32(c64);
291291
| ^^^ expected `i32`, found `i64`
292292
|
293-
help: you can convert an `i64` to an `i32` and panic if the converted value wouldn't fit
293+
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
294294
|
295295
LL | id_i32(c64.try_into().unwrap());
296296
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -328,7 +328,7 @@ error[E0308]: mismatched types
328328
LL | id_u8(b16);
329329
| ^^^ expected `u8`, found `u16`
330330
|
331-
help: you can convert a `u16` to a `u8` and panic if the converted value wouldn't fit
331+
help: you can convert a `u16` to a `u8` and panic if the converted value doesn't fit
332332
|
333333
LL | id_u8(b16.try_into().unwrap());
334334
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -339,7 +339,7 @@ error[E0308]: mismatched types
339339
LL | id_u8(b32);
340340
| ^^^ expected `u8`, found `u32`
341341
|
342-
help: you can convert a `u32` to a `u8` and panic if the converted value wouldn't fit
342+
help: you can convert a `u32` to a `u8` and panic if the converted value doesn't fit
343343
|
344344
LL | id_u8(b32.try_into().unwrap());
345345
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -350,7 +350,7 @@ error[E0308]: mismatched types
350350
LL | id_u8(b64);
351351
| ^^^ expected `u8`, found `u64`
352352
|
353-
help: you can convert a `u64` to a `u8` and panic if the converted value wouldn't fit
353+
help: you can convert a `u64` to a `u8` and panic if the converted value doesn't fit
354354
|
355355
LL | id_u8(b64.try_into().unwrap());
356356
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -361,7 +361,7 @@ error[E0308]: mismatched types
361361
LL | id_u8(bsize);
362362
| ^^^^^ expected `u8`, found `usize`
363363
|
364-
help: you can convert a `usize` to a `u8` and panic if the converted value wouldn't fit
364+
help: you can convert a `usize` to a `u8` and panic if the converted value doesn't fit
365365
|
366366
LL | id_u8(bsize.try_into().unwrap());
367367
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -381,7 +381,7 @@ error[E0308]: mismatched types
381381
LL | id_u16(b32);
382382
| ^^^ expected `u16`, found `u32`
383383
|
384-
help: you can convert a `u32` to a `u16` and panic if the converted value wouldn't fit
384+
help: you can convert a `u32` to a `u16` and panic if the converted value doesn't fit
385385
|
386386
LL | id_u16(b32.try_into().unwrap());
387387
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -392,7 +392,7 @@ error[E0308]: mismatched types
392392
LL | id_u16(b64);
393393
| ^^^ expected `u16`, found `u64`
394394
|
395-
help: you can convert a `u64` to a `u16` and panic if the converted value wouldn't fit
395+
help: you can convert a `u64` to a `u16` and panic if the converted value doesn't fit
396396
|
397397
LL | id_u16(b64.try_into().unwrap());
398398
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -403,7 +403,7 @@ error[E0308]: mismatched types
403403
LL | id_u16(bsize);
404404
| ^^^^^ expected `u16`, found `usize`
405405
|
406-
help: you can convert a `usize` to a `u16` and panic if the converted value wouldn't fit
406+
help: you can convert a `usize` to a `u16` and panic if the converted value doesn't fit
407407
|
408408
LL | id_u16(bsize.try_into().unwrap());
409409
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -432,7 +432,7 @@ error[E0308]: mismatched types
432432
LL | id_u32(b64);
433433
| ^^^ expected `u32`, found `u64`
434434
|
435-
help: you can convert a `u64` to a `u32` and panic if the converted value wouldn't fit
435+
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
436436
|
437437
LL | id_u32(b64.try_into().unwrap());
438438
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -443,7 +443,7 @@ error[E0308]: mismatched types
443443
LL | id_u32(bsize);
444444
| ^^^^^ expected `u32`, found `usize`
445445
|
446-
help: you can convert a `usize` to a `u32` and panic if the converted value wouldn't fit
446+
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
447447
|
448448
LL | id_u32(bsize.try_into().unwrap());
449449
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -481,7 +481,7 @@ error[E0308]: mismatched types
481481
LL | id_u64(bsize);
482482
| ^^^^^ expected `u64`, found `usize`
483483
|
484-
help: you can convert a `usize` to a `u64` and panic if the converted value wouldn't fit
484+
help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
485485
|
486486
LL | id_u64(bsize.try_into().unwrap());
487487
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -510,7 +510,7 @@ error[E0308]: mismatched types
510510
LL | id_usize(b32);
511511
| ^^^ expected `usize`, found `u32`
512512
|
513-
help: you can convert a `u32` to a `usize` and panic if the converted value wouldn't fit
513+
help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
514514
|
515515
LL | id_usize(b32.try_into().unwrap());
516516
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -521,7 +521,7 @@ error[E0308]: mismatched types
521521
LL | id_usize(b64);
522522
| ^^^ expected `usize`, found `u64`
523523
|
524-
help: you can convert a `u64` to a `usize` and panic if the converted value wouldn't fit
524+
help: you can convert a `u64` to a `usize` and panic if the converted value doesn't fit
525525
|
526526
LL | id_usize(b64.try_into().unwrap());
527527
| ^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/issues/issue-13359.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
44
LL | foo(1*(1 as isize));
55
| ^^^^^^^^^^^^^^ expected `i16`, found `isize`
66
|
7-
help: you can convert an `isize` to an `i16` and panic if the converted value wouldn't fit
7+
help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit
88
|
99
LL | foo((1*(1 as isize)).try_into().unwrap());
1010
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -15,7 +15,7 @@ error[E0308]: mismatched types
1515
LL | bar(1*(1 as usize));
1616
| ^^^^^^^^^^^^^^ expected `u32`, found `usize`
1717
|
18-
help: you can convert a `usize` to a `u32` and panic if the converted value wouldn't fit
18+
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
1919
|
2020
LL | bar((1*(1 as usize)).try_into().unwrap());
2121
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | let y: usize = x.foo();
1414
| |
1515
| expected due to this
1616
|
17-
help: you can convert an `isize` to a `usize` and panic if the converted value wouldn't fit
17+
help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
1818
|
1919
LL | let y: usize = x.foo().try_into().unwrap();
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/mismatched_types/issue-26480.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LL | write!(hello);
88
| -------------- in this macro invocation
99
|
1010
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
11-
help: you can convert a `usize` to a `u64` and panic if the converted value wouldn't fit
11+
help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
1212
|
1313
LL | ($arr.len() * size_of($arr[0])).try_into().unwrap());
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/numeric/const-scope.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ LL | let d: i8 = c;
5757
| |
5858
| expected due to this
5959
|
60-
help: you can convert an `i32` to an `i8` and panic if the converted value wouldn't fit
60+
help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
6161
|
6262
LL | let d: i8 = c.try_into().unwrap();
6363
| ^^^^^^^^^^^^^^^^^^^^^

src/test/ui/numeric/len.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
44
LL | test(array.len());
55
| ^^^^^^^^^^^ expected `u32`, found `usize`
66
|
7-
help: you can convert a `usize` to a `u32` and panic if the converted value wouldn't fit
7+
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
88
|
99
LL | test(array.len().try_into().unwrap());
1010
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/numeric/numeric-cast-2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | let x: u16 = foo();
66
| |
77
| expected due to this
88
|
9-
help: you can convert an `i32` to a `u16` and panic if the converted value wouldn't fit
9+
help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit
1010
|
1111
LL | let x: u16 = foo().try_into().unwrap();
1212
| ^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)