Skip to content

Commit a911963

Browse files
authored
Rollup merge of #60517 - estebank:wording, r=davidtwco
Reword casting message r? @davidtwco
2 parents df5a557 + 1e2af7d commit a911963

16 files changed

+115
-115
lines changed

src/librustc_typeck/check/demand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
523523

524524
let msg = format!("you can convert an `{}` to `{}`", checked_ty, expected_ty);
525525
let cast_msg = format!("you can cast an `{} to `{}`", checked_ty, expected_ty);
526-
let try_msg = format!("{} or panic if it the converted value wouldn't fit", msg);
526+
let try_msg = format!("{} and panic if the converted value wouldn't fit", msg);
527527
let lit_msg = format!(
528528
"change the type of the numeric literal from `{}` to `{}`",
529529
checked_ty,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ error[E0308]: mismatched types
4949
|
5050
LL | let _: i32 = f2(2i32);
5151
| ^^^^^^^^ expected i32, found u32
52-
help: you can convert an `u32` to `i32` or panic if it the converted value wouldn't fit
52+
help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit
5353
|
5454
LL | let _: i32 = f2(2i32).try_into().unwrap();
5555
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

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

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

+18-18
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error[E0308]: mismatched types
33
|
44
LL | id_i8(a16);
55
| ^^^ expected i8, found i16
6-
help: you can convert an `i16` to `i8` or panic if it the converted value wouldn't fit
6+
help: you can convert an `i16` to `i8` and panic if the converted value wouldn't fit
77
|
88
LL | id_i8(a16.try_into().unwrap());
99
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -13,7 +13,7 @@ error[E0308]: mismatched types
1313
|
1414
LL | id_i8(a32);
1515
| ^^^ expected i8, found i32
16-
help: you can convert an `i32` to `i8` or panic if it the converted value wouldn't fit
16+
help: you can convert an `i32` to `i8` and panic if the converted value wouldn't fit
1717
|
1818
LL | id_i8(a32.try_into().unwrap());
1919
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -23,7 +23,7 @@ error[E0308]: mismatched types
2323
|
2424
LL | id_i8(a64);
2525
| ^^^ expected i8, found i64
26-
help: you can convert an `i64` to `i8` or panic if it the converted value wouldn't fit
26+
help: you can convert an `i64` to `i8` and panic if the converted value wouldn't fit
2727
|
2828
LL | id_i8(a64.try_into().unwrap());
2929
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -42,7 +42,7 @@ error[E0308]: mismatched types
4242
|
4343
LL | id_i16(a32);
4444
| ^^^ expected i16, found i32
45-
help: you can convert an `i32` to `i16` or panic if it the converted value wouldn't fit
45+
help: you can convert an `i32` to `i16` and panic if the converted value wouldn't fit
4646
|
4747
LL | id_i16(a32.try_into().unwrap());
4848
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -52,7 +52,7 @@ error[E0308]: mismatched types
5252
|
5353
LL | id_i16(a64);
5454
| ^^^ expected i16, found i64
55-
help: you can convert an `i64` to `i16` or panic if it the converted value wouldn't fit
55+
help: you can convert an `i64` to `i16` and panic if the converted value wouldn't fit
5656
|
5757
LL | id_i16(a64.try_into().unwrap());
5858
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -80,7 +80,7 @@ error[E0308]: mismatched types
8080
|
8181
LL | id_i32(a64);
8282
| ^^^ expected i32, found i64
83-
help: you can convert an `i64` to `i32` or panic if it the converted value wouldn't fit
83+
help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
8484
|
8585
LL | id_i32(a64.try_into().unwrap());
8686
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -117,7 +117,7 @@ error[E0308]: mismatched types
117117
|
118118
LL | id_i8(c16);
119119
| ^^^ expected i8, found i16
120-
help: you can convert an `i16` to `i8` or panic if it the converted value wouldn't fit
120+
help: you can convert an `i16` to `i8` and panic if the converted value wouldn't fit
121121
|
122122
LL | id_i8(c16.try_into().unwrap());
123123
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -127,7 +127,7 @@ error[E0308]: mismatched types
127127
|
128128
LL | id_i8(c32);
129129
| ^^^ expected i8, found i32
130-
help: you can convert an `i32` to `i8` or panic if it the converted value wouldn't fit
130+
help: you can convert an `i32` to `i8` and panic if the converted value wouldn't fit
131131
|
132132
LL | id_i8(c32.try_into().unwrap());
133133
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -137,7 +137,7 @@ error[E0308]: mismatched types
137137
|
138138
LL | id_i8(c64);
139139
| ^^^ expected i8, found i64
140-
help: you can convert an `i64` to `i8` or panic if it the converted value wouldn't fit
140+
help: you can convert an `i64` to `i8` and panic if the converted value wouldn't fit
141141
|
142142
LL | id_i8(c64.try_into().unwrap());
143143
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -156,7 +156,7 @@ error[E0308]: mismatched types
156156
|
157157
LL | id_i16(c32);
158158
| ^^^ expected i16, found i32
159-
help: you can convert an `i32` to `i16` or panic if it the converted value wouldn't fit
159+
help: you can convert an `i32` to `i16` and panic if the converted value wouldn't fit
160160
|
161161
LL | id_i16(c32.try_into().unwrap());
162162
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -166,7 +166,7 @@ error[E0308]: mismatched types
166166
|
167167
LL | id_i16(c64);
168168
| ^^^ expected i16, found i64
169-
help: you can convert an `i64` to `i16` or panic if it the converted value wouldn't fit
169+
help: you can convert an `i64` to `i16` and panic if the converted value wouldn't fit
170170
|
171171
LL | id_i16(c64.try_into().unwrap());
172172
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -194,7 +194,7 @@ error[E0308]: mismatched types
194194
|
195195
LL | id_i32(c64);
196196
| ^^^ expected i32, found i64
197-
help: you can convert an `i64` to `i32` or panic if it the converted value wouldn't fit
197+
help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
198198
|
199199
LL | id_i32(c64.try_into().unwrap());
200200
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -231,7 +231,7 @@ error[E0308]: mismatched types
231231
|
232232
LL | id_u8(b16);
233233
| ^^^ expected u8, found u16
234-
help: you can convert an `u16` to `u8` or panic if it the converted value wouldn't fit
234+
help: you can convert an `u16` to `u8` and panic if the converted value wouldn't fit
235235
|
236236
LL | id_u8(b16.try_into().unwrap());
237237
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -241,7 +241,7 @@ error[E0308]: mismatched types
241241
|
242242
LL | id_u8(b32);
243243
| ^^^ expected u8, found u32
244-
help: you can convert an `u32` to `u8` or panic if it the converted value wouldn't fit
244+
help: you can convert an `u32` to `u8` and panic if the converted value wouldn't fit
245245
|
246246
LL | id_u8(b32.try_into().unwrap());
247247
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -251,7 +251,7 @@ error[E0308]: mismatched types
251251
|
252252
LL | id_u8(b64);
253253
| ^^^ expected u8, found u64
254-
help: you can convert an `u64` to `u8` or panic if it the converted value wouldn't fit
254+
help: you can convert an `u64` to `u8` and panic if the converted value wouldn't fit
255255
|
256256
LL | id_u8(b64.try_into().unwrap());
257257
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -270,7 +270,7 @@ error[E0308]: mismatched types
270270
|
271271
LL | id_u16(b32);
272272
| ^^^ expected u16, found u32
273-
help: you can convert an `u32` to `u16` or panic if it the converted value wouldn't fit
273+
help: you can convert an `u32` to `u16` and panic if the converted value wouldn't fit
274274
|
275275
LL | id_u16(b32.try_into().unwrap());
276276
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -280,7 +280,7 @@ error[E0308]: mismatched types
280280
|
281281
LL | id_u16(b64);
282282
| ^^^ expected u16, found u64
283-
help: you can convert an `u64` to `u16` or panic if it the converted value wouldn't fit
283+
help: you can convert an `u64` to `u16` and panic if the converted value wouldn't fit
284284
|
285285
LL | id_u16(b64.try_into().unwrap());
286286
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -308,7 +308,7 @@ error[E0308]: mismatched types
308308
|
309309
LL | id_u32(b64);
310310
| ^^^ expected u32, found u64
311-
help: you can convert an `u64` to `u32` or panic if it the converted value wouldn't fit
311+
help: you can convert an `u64` to `u32` and panic if the converted value wouldn't fit
312312
|
313313
LL | id_u32(b64.try_into().unwrap());
314314
| ^^^^^^^^^^^^^^^^^^^^^^^

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error[E0308]: mismatched types
33
|
44
LL | foo(1*(1 as isize));
55
| ^^^^^^^^^^^^^^ expected i16, found isize
6-
help: you can convert an `isize` to `i16` or panic if it the converted value wouldn't fit
6+
help: you can convert an `isize` to `i16` and panic if the converted value wouldn't fit
77
|
88
LL | foo((1*(1 as isize)).try_into().unwrap());
99
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -13,7 +13,7 @@ error[E0308]: mismatched types
1313
|
1414
LL | bar(1*(1 as usize));
1515
| ^^^^^^^^^^^^^^ expected u32, found usize
16-
help: you can convert an `usize` to `u32` or panic if it the converted value wouldn't fit
16+
help: you can convert an `usize` to `u32` and panic if the converted value wouldn't fit
1717
|
1818
LL | bar((1*(1 as usize)).try_into().unwrap());
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error[E0308]: mismatched types
33
|
44
LL | X = Trait::Number,
55
| ^^^^^^^^^^^^^ expected isize, found i32
6-
help: you can convert an `i32` to `isize` or panic if it the converted value wouldn't fit
6+
help: you can convert an `i32` to `isize` and panic if the converted value wouldn't fit
77
|
88
LL | X = Trait::Number.try_into().unwrap(),
99
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ error[E0308]: mismatched types
1111
|
1212
LL | let y: usize = x.foo();
1313
| ^^^^^^^ expected usize, found isize
14-
help: you can convert an `isize` to `usize` or panic if it the converted value wouldn't fit
14+
help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
1515
|
1616
LL | let y: usize = x.foo().try_into().unwrap();
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | $arr.len() * size_of($arr[0]));
66
...
77
LL | write!(hello);
88
| -------------- in this macro invocation
9-
help: you can convert an `usize` to `u64` or panic if it the converted value wouldn't fit
9+
help: you can convert an `usize` to `u64` and panic if the converted value wouldn't fit
1010
|
1111
LL | ($arr.len() * size_of($arr[0])).try_into().unwrap());
1212
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ error[E0308]: mismatched types
3737
|
3838
LL | let d: i8 = c;
3939
| ^ expected i8, found i32
40-
help: you can convert an `i32` to `i8` or panic if it the converted value wouldn't fit
40+
help: you can convert an `i32` to `i8` and panic if the converted value wouldn't fit
4141
|
4242
LL | let d: i8 = c.try_into().unwrap();
4343
| ^^^^^^^^^^^^^^^^^^^^^

src/test/ui/numeric/len.stderr

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

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error[E0308]: mismatched types
33
|
44
LL | let x: u16 = foo();
55
| ^^^^^ expected u16, found i32
6-
help: you can convert an `i32` to `u16` or panic if it the converted value wouldn't fit
6+
help: you can convert an `i32` to `u16` and panic if the converted value wouldn't fit
77
|
88
LL | let x: u16 = foo().try_into().unwrap();
99
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -13,7 +13,7 @@ error[E0308]: mismatched types
1313
|
1414
LL | let y: i64 = x + x;
1515
| ^^^^^ expected i64, found u16
16-
help: you can convert an `u16` to `i64` or panic if it the converted value wouldn't fit
16+
help: you can convert an `u16` to `i64` and panic if the converted value wouldn't fit
1717
|
1818
LL | let y: i64 = (x + x).try_into().unwrap();
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -23,7 +23,7 @@ error[E0308]: mismatched types
2323
|
2424
LL | let z: i32 = x + x;
2525
| ^^^^^ expected i32, found u16
26-
help: you can convert an `u16` to `i32` or panic if it the converted value wouldn't fit
26+
help: you can convert an `u16` to `i32` and panic if the converted value wouldn't fit
2727
|
2828
LL | let z: i32 = (x + x).try_into().unwrap();
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)