fork/rust

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

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
2.8 KiB65 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   |    --- -- help: consider relaxing the implicit `Sized` restriction: `: ?Sized`
6   |        |
7   |        required by this bound in `bot`
8...
9LL |     s[1..2] = bot();
10   |               ^^^ doesn't have a size known at compile-time
11   |
12   = help: the trait `std::marker::Sized` is not implemented for `str`
13   = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
14
15error[E0277]: the size for values of type `str` cannot be known at compilation time
16  --> $DIR/str-mut-idx.rs:4:5
17   |
18LL |     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
25error[E0277]: the type `str` cannot be indexed by `usize`
26  --> $DIR/str-mut-idx.rs:7:5
27   |
28LL |     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
34error[E0277]: the type `str` cannot be indexed by `{integer}`
35  --> $DIR/str-mut-idx.rs:9:15
36   |
37LL |     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
44error[E0277]: the type `str` cannot be indexed by `{integer}`
45  --> $DIR/str-mut-idx.rs:11:25
46   |
47LL |     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
54error[E0277]: the type `str` cannot be indexed by `char`
55  --> $DIR/str-mut-idx.rs:13:5
56   |
57LL |     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
63error: aborting due to 6 previous errors
64
65For more information about this error, try `rustc --explain E0277`.