fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.2 KiB81 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 |     s[1..2] = bot();
5   |               ^^^ doesn't have a size known at compile-time
6   |
7   = help: the trait `Sized` is not implemented for `str`
8note: required by a bound in `bot`
9  --> $DIR/str-mut-idx.rs:1:8
10   |
11LL | fn bot<T>() -> T { loop {} }
12   |        ^ required by this bound in `bot`
13help: consider relaxing the implicit `Sized` restriction
14   |
15LL | fn bot<T: ?Sized>() -> T { loop {} }
16   |         ++++++++
17
18error[E0277]: the size for values of type `str` cannot be known at compilation time
19  --> $DIR/str-mut-idx.rs:4:5
20   |
21LL |     s[1..2] = bot();
22   |     ^^^^^^^ doesn't have a size known at compile-time
23   |
24   = help: the trait `Sized` is not implemented for `str`
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:7
29   |
30LL |     s[1usize] = bot();
31   |       ^^^^^^ string indices are ranges of `usize`
32   |
33   = help: the trait `SliceIndex<str>` is not implemented for `usize`
34   = help: the trait `SliceIndex<[_]>` is implemented for `usize`
35   = help: for that trait implementation, expected `[_]`, found `str`
36   = note: required for `str` to implement `Index<usize>`
37
38error[E0277]: the type `str` cannot be indexed by `{integer}`
39  --> $DIR/str-mut-idx.rs:9:15
40   |
41LL |     s.get_mut(1);
42   |       ------- ^ string indices are ranges of `usize`
43   |       |
44   |       required by a bound introduced by this call
45   |
46   = help: the trait `SliceIndex<str>` is not implemented for `{integer}`
47   = note: you can use `.chars().nth()` or `.bytes().nth()`
48           for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
49   = help: the trait `SliceIndex<[_]>` is implemented for `usize`
50   = help: for that trait implementation, expected `[_]`, found `str`
51note: required by a bound in `core::str::<impl str>::get_mut`
52  --> $SRC_DIR/core/src/str/mod.rs:LL:COL
53
54error[E0277]: the type `str` cannot be indexed by `{integer}`
55  --> $DIR/str-mut-idx.rs:11:25
56   |
57LL |     s.get_unchecked_mut(1);
58   |       ----------------- ^ string indices are ranges of `usize`
59   |       |
60   |       required by a bound introduced by this call
61   |
62   = help: the trait `SliceIndex<str>` is not implemented for `{integer}`
63   = note: you can use `.chars().nth()` or `.bytes().nth()`
64           for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
65   = help: the trait `SliceIndex<[_]>` is implemented for `usize`
66   = help: for that trait implementation, expected `[_]`, found `str`
67note: required by a bound in `core::str::<impl str>::get_unchecked_mut`
68  --> $SRC_DIR/core/src/str/mod.rs:LL:COL
69
70error[E0277]: the type `str` cannot be indexed by `char`
71  --> $DIR/str-mut-idx.rs:13:7
72   |
73LL |     s['c'];
74   |       ^^^ string indices are ranges of `usize`
75   |
76   = help: the trait `SliceIndex<str>` is not implemented for `char`
77   = note: required for `str` to implement `Index<char>`
78
79error: aborting due to 6 previous errors
80
81For more information about this error, try `rustc --explain E0277`.