]>
Commit | Line | Data |
---|---|---|
1a4d82fc | 1 | pub fn main() { |
c30ab7b3 | 2 | let v: Vec<isize> = vec![0, 1, 2, 3, 4, 5]; |
1a4d82fc | 3 | let s: String = "abcdef".to_string(); |
85aaf69f SL |
4 | v[3_usize]; |
5 | v[3]; | |
9fa01778 XL |
6 | v[3u8]; //~ERROR : the type `[isize]` cannot be indexed by `u8` |
7 | v[3i8]; //~ERROR : the type `[isize]` cannot be indexed by `i8` | |
8 | v[3u32]; //~ERROR : the type `[isize]` cannot be indexed by `u32` | |
9 | v[3i32]; //~ERROR : the type `[isize]` cannot be indexed by `i32` | |
85aaf69f | 10 | s.as_bytes()[3_usize]; |
1a4d82fc | 11 | s.as_bytes()[3]; |
9fa01778 XL |
12 | s.as_bytes()[3u8]; //~ERROR : the type `[u8]` cannot be indexed by `u8` |
13 | s.as_bytes()[3i8]; //~ERROR : the type `[u8]` cannot be indexed by `i8` | |
14 | s.as_bytes()[3u32]; //~ERROR : the type `[u8]` cannot be indexed by `u32` | |
15 | s.as_bytes()[3i32]; //~ERROR : the type `[u8]` cannot be indexed by `i32` | |
1a4d82fc | 16 | } |