]> git.lizzy.rs Git - rust.git/blob - src/test/ui/str/str-mut-idx.stderr
Rollup merge of #61207 - taiki-e:arbitrary_self_types-lifetime-elision-2, r=Centril
[rust.git] / src / test / ui / str / str-mut-idx.stderr
1 error[E0277]: the size for values of type `str` cannot be known at compilation time
2   --> $DIR/str-mut-idx.rs:4:15
3    |
4 LL |     s[1..2] = bot();
5    |               ^^^ doesn't have a size known at compile-time
6    |
7    = help: the trait `std::marker::Sized` is not implemented for `str`
8    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
9 note: required by `bot`
10   --> $DIR/str-mut-idx.rs:1:1
11    |
12 LL | fn bot<T>() -> T { loop {} }
13    | ^^^^^^^^^^^^^^^^
14
15 error[E0277]: the size for values of type `str` cannot be known at compilation time
16   --> $DIR/str-mut-idx.rs:4:5
17    |
18 LL |     s[1..2] = bot();
19    |     ^^^^^^^ doesn't have a size known at compile-time
20    |
21    = help: the trait `std::marker::Sized` is not implemented for `str`
22    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
23    = note: the left-hand-side of an assignment must have a statically known size
24
25 error[E0277]: the type `str` cannot be indexed by `usize`
26   --> $DIR/str-mut-idx.rs:7:5
27    |
28 LL |     s[1usize] = bot();
29    |     ^^^^^^^^^ string indices are ranges of `usize`
30    |
31    = help: the trait `std::slice::SliceIndex<str>` is not implemented for `usize`
32    = note: required because of the requirements on the impl of `std::ops::Index<usize>` for `str`
33
34 error[E0277]: the type `str` cannot be indexed by `{integer}`
35   --> $DIR/str-mut-idx.rs:9:7
36    |
37 LL |     s.get_mut(1);
38    |       ^^^^^^^ string indices are ranges of `usize`
39    |
40    = help: the trait `std::slice::SliceIndex<str>` is not implemented for `{integer}`
41    = note: you can use `.chars().nth()` or `.bytes().nth()`
42            see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
43
44 error[E0277]: the type `str` cannot be indexed by `{integer}`
45   --> $DIR/str-mut-idx.rs:11:7
46    |
47 LL |     s.get_unchecked_mut(1);
48    |       ^^^^^^^^^^^^^^^^^ string indices are ranges of `usize`
49    |
50    = help: the trait `std::slice::SliceIndex<str>` is not implemented for `{integer}`
51    = note: you can use `.chars().nth()` or `.bytes().nth()`
52            see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
53
54 error[E0277]: the type `str` cannot be indexed by `char`
55   --> $DIR/str-mut-idx.rs:13:5
56    |
57 LL |     s['c'];
58    |     ^^^^^^ string indices are ranges of `usize`
59    |
60    = help: the trait `std::slice::SliceIndex<str>` is not implemented for `char`
61    = note: required because of the requirements on the impl of `std::ops::Index<char>` for `str`
62
63 error: aborting due to 6 previous errors
64
65 For more information about this error, try `rustc --explain E0277`.