fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

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