You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/ui/cast_size.stderr
+53Lines changed: 53 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,12 @@ error: casting `isize` to `i8` may truncate the value
4
4
LL | 1isize as i8;
5
5
| ^^^^^^^^^^^^
6
6
|
7
+
= help: if this is intentional allow the lint with `#[allow(clippy::cast_precision_loss)]` ...
7
8
= note: `-D clippy::cast-possible-truncation` implied by `-D warnings`
9
+
help: ... or use `try_from` and handle the error accordingly
10
+
|
11
+
LL | i8::try_from(1isize);
12
+
| ~~~~~~~~~~~~~~~~~~~~
8
13
9
14
error: casting `isize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`isize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
10
15
--> $DIR/cast_size.rs:15:5
@@ -37,24 +42,48 @@ error: casting `isize` to `i32` may truncate the value on targets with 64-bit wi
37
42
|
38
43
LL | 1isize as i32;
39
44
| ^^^^^^^^^^^^^
45
+
|
46
+
= help: if this is intentional allow the lint with `#[allow(clippy::cast_precision_loss)]` ...
47
+
help: ... or use `try_from` and handle the error accordingly
48
+
|
49
+
LL | i32::try_from(1isize);
50
+
| ~~~~~~~~~~~~~~~~~~~~~
40
51
41
52
error: casting `isize` to `u32` may truncate the value on targets with 64-bit wide pointers
42
53
--> $DIR/cast_size.rs:20:5
43
54
|
44
55
LL | 1isize as u32;
45
56
| ^^^^^^^^^^^^^
57
+
|
58
+
= help: if this is intentional allow the lint with `#[allow(clippy::cast_precision_loss)]` ...
59
+
help: ... or use `try_from` and handle the error accordingly
60
+
|
61
+
LL | u32::try_from(1isize);
62
+
| ~~~~~~~~~~~~~~~~~~~~~
46
63
47
64
error: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers
48
65
--> $DIR/cast_size.rs:21:5
49
66
|
50
67
LL | 1usize as u32;
51
68
| ^^^^^^^^^^^^^
69
+
|
70
+
= help: if this is intentional allow the lint with `#[allow(clippy::cast_precision_loss)]` ...
71
+
help: ... or use `try_from` and handle the error accordingly
72
+
|
73
+
LL | u32::try_from(1usize);
74
+
| ~~~~~~~~~~~~~~~~~~~~~
52
75
53
76
error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers
54
77
--> $DIR/cast_size.rs:22:5
55
78
|
56
79
LL | 1usize as i32;
57
80
| ^^^^^^^^^^^^^
81
+
|
82
+
= help: if this is intentional allow the lint with `#[allow(clippy::cast_precision_loss)]` ...
83
+
help: ... or use `try_from` and handle the error accordingly
84
+
|
85
+
LL | i32::try_from(1usize);
86
+
| ~~~~~~~~~~~~~~~~~~~~~
58
87
59
88
error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers
60
89
--> $DIR/cast_size.rs:22:5
@@ -69,18 +98,36 @@ error: casting `i64` to `isize` may truncate the value on targets with 32-bit wi
69
98
|
70
99
LL | 1i64 as isize;
71
100
| ^^^^^^^^^^^^^
101
+
|
102
+
= help: if this is intentional allow the lint with `#[allow(clippy::cast_precision_loss)]` ...
103
+
help: ... or use `try_from` and handle the error accordingly
104
+
|
105
+
LL | isize::try_from(1i64);
106
+
| ~~~~~~~~~~~~~~~~~~~~~
72
107
73
108
error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers
74
109
--> $DIR/cast_size.rs:25:5
75
110
|
76
111
LL | 1i64 as usize;
77
112
| ^^^^^^^^^^^^^
113
+
|
114
+
= help: if this is intentional allow the lint with `#[allow(clippy::cast_precision_loss)]` ...
115
+
help: ... or use `try_from` and handle the error accordingly
116
+
|
117
+
LL | usize::try_from(1i64);
118
+
| ~~~~~~~~~~~~~~~~~~~~~
78
119
79
120
error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers
80
121
--> $DIR/cast_size.rs:26:5
81
122
|
82
123
LL | 1u64 as isize;
83
124
| ^^^^^^^^^^^^^
125
+
|
126
+
= help: if this is intentional allow the lint with `#[allow(clippy::cast_precision_loss)]` ...
127
+
help: ... or use `try_from` and handle the error accordingly
128
+
|
129
+
LL | isize::try_from(1u64);
130
+
| ~~~~~~~~~~~~~~~~~~~~~
84
131
85
132
error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
86
133
--> $DIR/cast_size.rs:26:5
@@ -93,6 +140,12 @@ error: casting `u64` to `usize` may truncate the value on targets with 32-bit wi
93
140
|
94
141
LL | 1u64 as usize;
95
142
| ^^^^^^^^^^^^^
143
+
|
144
+
= help: if this is intentional allow the lint with `#[allow(clippy::cast_precision_loss)]` ...
145
+
help: ... or use `try_from` and handle the error accordingly
146
+
|
147
+
LL | usize::try_from(1u64);
148
+
| ~~~~~~~~~~~~~~~~~~~~~
96
149
97
150
error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers
0 commit comments