]> git.lizzy.rs Git - rust.git/blob - tests/ui/str/str-mut-idx.rs
Rollup merge of #106797 - FawazTirmizi:dev/issues/104284, r=bjorn3
[rust.git] / tests / ui / str / str-mut-idx.rs
1 fn bot<T>() -> T { loop {} }
2
3 fn mutate(s: &mut str) {
4     s[1..2] = bot();
5     //~^ ERROR the size for values of type
6     //~| ERROR the size for values of type
7     s[1usize] = bot();
8     //~^ ERROR the type `str` cannot be indexed by `usize`
9     s.get_mut(1);
10     //~^ ERROR the type `str` cannot be indexed by `{integer}`
11     s.get_unchecked_mut(1);
12     //~^ ERROR the type `str` cannot be indexed by `{integer}`
13     s['c'];
14     //~^ ERROR the type `str` cannot be indexed by `char`
15 }
16
17 pub fn main() {}