2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2014-06-19 18:22:33 -07:00
|
|
|
let s: &str = "hello";
|
2019-01-14 08:10:45 -05:00
|
|
|
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`
|
2011-08-19 15:16:48 -07:00
|
|
|
}
|