@@ -16,6 +16,7 @@ fn main() {
16
16
fn id_i16 ( n : i16 ) -> i16 { n }
17
17
fn id_i32 ( n : i32 ) -> i32 { n }
18
18
fn id_i64 ( n : i64 ) -> i64 { n }
19
+ fn id_isize ( n : isize ) -> isize { n }
19
20
20
21
// the smallest values that need these types
21
22
let b8: u8 = 16 ;
@@ -27,6 +28,11 @@ fn main() {
27
28
fn id_u16 ( n : u16 ) -> u16 { n }
28
29
fn id_u32 ( n : u32 ) -> u32 { n }
29
30
fn id_u64 ( n : u64 ) -> u64 { n }
31
+ fn id_usize ( n : usize ) -> usize { n }
32
+
33
+ // Values for testing *size
34
+ let asize: isize = 1 ;
35
+ let bsize: usize = 3 ;
30
36
31
37
id_i8 ( a8) ; // ok
32
38
id_i8 ( a16) ;
@@ -38,6 +44,9 @@ fn main() {
38
44
id_i8 ( a64) ;
39
45
//~^ ERROR mismatched types
40
46
//~| expected `i8`, found `i64`
47
+ id_i8 ( asize) ;
48
+ //~^ ERROR mismatched types
49
+ //~| expected `i8`, found `isize`
41
50
42
51
id_i16 ( a8) ;
43
52
//~^ ERROR mismatched types
@@ -49,6 +58,9 @@ fn main() {
49
58
id_i16 ( a64) ;
50
59
//~^ ERROR mismatched types
51
60
//~| expected `i16`, found `i64`
61
+ id_i16 ( asize) ;
62
+ //~^ ERROR mismatched types
63
+ //~| expected `i16`, found `isize`
52
64
53
65
id_i32 ( a8) ;
54
66
//~^ ERROR mismatched types
@@ -60,6 +72,9 @@ fn main() {
60
72
id_i32 ( a64) ;
61
73
//~^ ERROR mismatched types
62
74
//~| expected `i32`, found `i64`
75
+ id_i32 ( asize) ;
76
+ //~^ ERROR mismatched types
77
+ //~| expected `i32`, found `isize`
63
78
64
79
id_i64 ( a8) ;
65
80
//~^ ERROR mismatched types
@@ -71,6 +86,23 @@ fn main() {
71
86
//~^ ERROR mismatched types
72
87
//~| expected `i64`, found `i32`
73
88
id_i64 ( a64) ; // ok
89
+ id_i64 ( asize) ;
90
+ //~^ ERROR mismatched types
91
+ //~| expected `i64`, found `isize`
92
+
93
+ id_isize ( a8) ;
94
+ //~^ ERROR mismatched types
95
+ //~| expected `isize`, found `i8`
96
+ id_isize ( a16) ;
97
+ //~^ ERROR mismatched types
98
+ //~| expected `isize`, found `i16`
99
+ id_isize ( a32) ;
100
+ //~^ ERROR mismatched types
101
+ //~| expected `isize`, found `i32`
102
+ id_isize ( a64) ;
103
+ //~^ ERROR mismatched types
104
+ //~| expected `isize`, found `i64`
105
+ id_isize ( asize) ; //ok
74
106
75
107
id_i8 ( c8) ; // ok
76
108
id_i8 ( c16) ;
@@ -126,6 +158,9 @@ fn main() {
126
158
id_u8 ( b64) ;
127
159
//~^ ERROR mismatched types
128
160
//~| expected `u8`, found `u64`
161
+ id_u8 ( bsize) ;
162
+ //~^ ERROR mismatched types
163
+ //~| expected `u8`, found `usize`
129
164
130
165
id_u16 ( b8) ;
131
166
//~^ ERROR mismatched types
@@ -137,6 +172,9 @@ fn main() {
137
172
id_u16 ( b64) ;
138
173
//~^ ERROR mismatched types
139
174
//~| expected `u16`, found `u64`
175
+ id_u16 ( bsize) ;
176
+ //~^ ERROR mismatched types
177
+ //~| expected `u16`, found `usize`
140
178
141
179
id_u32 ( b8) ;
142
180
//~^ ERROR mismatched types
@@ -148,6 +186,9 @@ fn main() {
148
186
id_u32 ( b64) ;
149
187
//~^ ERROR mismatched types
150
188
//~| expected `u32`, found `u64`
189
+ id_u32 ( bsize) ;
190
+ //~^ ERROR mismatched types
191
+ //~| expected `u32`, found `usize`
151
192
152
193
id_u64 ( b8) ;
153
194
//~^ ERROR mismatched types
@@ -159,4 +200,21 @@ fn main() {
159
200
//~^ ERROR mismatched types
160
201
//~| expected `u64`, found `u32`
161
202
id_u64 ( b64) ; // ok
203
+ id_u64 ( bsize) ;
204
+ //~^ ERROR mismatched types
205
+ //~| expected `u64`, found `usize`
206
+
207
+ id_usize ( b8) ;
208
+ //~^ ERROR mismatched types
209
+ //~| expected `usize`, found `u8`
210
+ id_usize ( b16) ;
211
+ //~^ ERROR mismatched types
212
+ //~| expected `usize`, found `u16`
213
+ id_usize ( b32) ;
214
+ //~^ ERROR mismatched types
215
+ //~| expected `usize`, found `u32`
216
+ id_usize ( b64) ;
217
+ //~^ ERROR mismatched types
218
+ //~| expected `usize`, found `u64`
219
+ id_usize ( bsize) ; //ok
162
220
}
0 commit comments