fork/rust

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

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
2.8 KiB67 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>
12help: consider relaxing the implicit `Sized` restriction
13   |
14LL | fn bot<T: ?Sized>() -> T { loop {} }
15   |         ^^^^^^^^
16
17error[E0277]: the size for values of type `str` cannot be known at compilation time
18  --> $DIR/str-mut-idx.rs:4:5
19   |
20LL |     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`
24   = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
25   = note: the left-hand-side of an assignment must have a statically known size
26
27error[E0277]: the type `str` cannot be indexed by `usize`
28  --> $DIR/str-mut-idx.rs:7:5
29   |
30LL |     s[1usize] = bot();
31   |     ^^^^^^^^^ string indices are ranges of `usize`
32   |
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`
35
36error[E0277]: the type `str` cannot be indexed by `{integer}`
37  --> $DIR/str-mut-idx.rs:9:15
38   |
39LL |     s.get_mut(1);
40   |               ^ string indices are ranges of `usize`
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
46error[E0277]: the type `str` cannot be indexed by `{integer}`
47  --> $DIR/str-mut-idx.rs:11:25
48   |
49LL |     s.get_unchecked_mut(1);
50   |                         ^ string indices are ranges of `usize`
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
56error[E0277]: the type `str` cannot be indexed by `char`
57  --> $DIR/str-mut-idx.rs:13:5
58   |
59LL |     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
65error: aborting due to 6 previous errors
66
67For more information about this error, try `rustc --explain E0277`.