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