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