mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
8 lines
372 B
Rust
8 lines
372 B
Rust
pub fn main() {
|
|
let s: &str = "hello";
|
|
let _: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}`
|
|
let _ = s.get(4); //~ ERROR the type `str` cannot be indexed by `{integer}`
|
|
let _ = s.get_unchecked(4); //~ ERROR the type `str` cannot be indexed by `{integer}`
|
|
let _: u8 = s['c']; //~ ERROR the type `str` cannot be indexed by `char`
|
|
}
|