Skip to content

Commit 2b936bb

Browse files
committed
fixup! Note numeric literals that can never fit in an expected type
1 parent afbbd38 commit 2b936bb

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/librustc_typeck/check/demand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
833833
// We now know that converting either the lhs or rhs is fallible. Before we
834834
// suggest a fallible conversion, check if the value can never fit in the
835835
// expected type.
836-
let msg = format!("`{}` can never fit into `{}`", src, expected_ty);
836+
let msg = format!("`{}` cannot fit into type `{}`", src, expected_ty);
837837
err.span_note(expr.span, &msg);
838838
return;
839839
} else if in_const_context {

src/test/ui/numeric/numeric-cast-no-fix.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
44
LL | x_usize > -1_isize;
55
| ^^^^^^^^ expected `usize`, found `isize`
66
|
7-
note: `-1_isize` can never fit into `usize`
7+
note: `-1_isize` cannot fit into type `usize`
88
--> $DIR/numeric-cast-no-fix.rs:10:15
99
|
1010
LL | x_usize > -1_isize;
@@ -16,7 +16,7 @@ error[E0308]: mismatched types
1616
LL | x_u128 > -1_isize;
1717
| ^^^^^^^^ expected `u128`, found `isize`
1818
|
19-
note: `-1_isize` can never fit into `u128`
19+
note: `-1_isize` cannot fit into type `u128`
2020
--> $DIR/numeric-cast-no-fix.rs:12:14
2121
|
2222
LL | x_u128 > -1_isize;
@@ -28,7 +28,7 @@ error[E0308]: mismatched types
2828
LL | x_u64 > -1_isize;
2929
| ^^^^^^^^ expected `u64`, found `isize`
3030
|
31-
note: `-1_isize` can never fit into `u64`
31+
note: `-1_isize` cannot fit into type `u64`
3232
--> $DIR/numeric-cast-no-fix.rs:14:13
3333
|
3434
LL | x_u64 > -1_isize;
@@ -40,7 +40,7 @@ error[E0308]: mismatched types
4040
LL | x_u32 > -1_isize;
4141
| ^^^^^^^^ expected `u32`, found `isize`
4242
|
43-
note: `-1_isize` can never fit into `u32`
43+
note: `-1_isize` cannot fit into type `u32`
4444
--> $DIR/numeric-cast-no-fix.rs:16:13
4545
|
4646
LL | x_u32 > -1_isize;
@@ -52,7 +52,7 @@ error[E0308]: mismatched types
5252
LL | x_u16 > -1_isize;
5353
| ^^^^^^^^ expected `u16`, found `isize`
5454
|
55-
note: `-1_isize` can never fit into `u16`
55+
note: `-1_isize` cannot fit into type `u16`
5656
--> $DIR/numeric-cast-no-fix.rs:18:13
5757
|
5858
LL | x_u16 > -1_isize;

src/test/ui/repeat_count.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ error[E0308]: mismatched types
4040
LL | let f = [0; -4_isize];
4141
| ^^^^^^^^ expected `usize`, found `isize`
4242
|
43-
note: `-4_isize` can never fit into `usize`
43+
note: `-4_isize` cannot fit into type `usize`
4444
--> $DIR/repeat_count.rs:19:17
4545
|
4646
LL | let f = [0; -4_isize];
@@ -52,7 +52,7 @@ error[E0308]: mismatched types
5252
LL | let f = [0_usize; -1_isize];
5353
| ^^^^^^^^ expected `usize`, found `isize`
5454
|
55-
note: `-1_isize` can never fit into `usize`
55+
note: `-1_isize` cannot fit into type `usize`
5656
--> $DIR/repeat_count.rs:22:23
5757
|
5858
LL | let f = [0_usize; -1_isize];

0 commit comments

Comments
 (0)