]> git.lizzy.rs Git - rust.git/blob - src/test/ui/str/str-idx.rs
Rollup merge of #98640 - cuviper:stable-rust-analyzer, r=Mark-Simulacrum
[rust.git] / src / test / ui / str / str-idx.rs
1 pub fn main() {
2     let s: &str = "hello";
3     let _: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}`
4     let _ = s.get(4); //~ ERROR the type `str` cannot be indexed by `{integer}`
5     let _ = s.get_unchecked(4); //~ ERROR the type `str` cannot be indexed by `{integer}`
6     let _: u8 = s['c']; //~ ERROR the type `str` cannot be indexed by `char`
7 }