summaryrefslogtreecommitdiffstats
path: root/src/test/ui/str/str-mut-idx.stderr
blob: 2d062e56a9bdd121b9f2f1924eca64323a7a479d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
error[E0277]: the size for values of type `str` cannot be known at compilation time
  --> $DIR/str-mut-idx.rs:4:15
   |
LL |     s[1..2] = bot();
   |               ^^^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `str`
note: required by a bound in `bot`
  --> $DIR/str-mut-idx.rs:1:8
   |
LL | fn bot<T>() -> T { loop {} }
   |        ^ required by this bound in `bot`
help: consider relaxing the implicit `Sized` restriction
   |
LL | fn bot<T: ?Sized>() -> T { loop {} }
   |         ++++++++

error[E0277]: the size for values of type `str` cannot be known at compilation time
  --> $DIR/str-mut-idx.rs:4:5
   |
LL |     s[1..2] = bot();
   |     ^^^^^^^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `str`
   = note: the left-hand-side of an assignment must have a statically known size

error[E0277]: the type `str` cannot be indexed by `usize`
  --> $DIR/str-mut-idx.rs:7:7
   |
LL |     s[1usize] = bot();
   |       ^^^^^^ string indices are ranges of `usize`
   |
   = help: the trait `SliceIndex<str>` is not implemented for `usize`
   = help: the trait `SliceIndex<[T]>` is implemented for `usize`
   = note: required because of the requirements on the impl of `Index<usize>` for `str`

error[E0277]: the type `str` cannot be indexed by `{integer}`
  --> $DIR/str-mut-idx.rs:9:15
   |
LL |     s.get_mut(1);
   |       ------- ^ string indices are ranges of `usize`
   |       |
   |       required by a bound introduced by this call
   |
   = help: the trait `SliceIndex<str>` is not implemented for `{integer}`
   = note: you can use `.chars().nth()` or `.bytes().nth()`
           for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
   = help: the trait `SliceIndex<[T]>` is implemented for `usize`
note: required by a bound in `core::str::<impl str>::get_mut`
  --> $SRC_DIR/core/src/str/mod.rs:LL:COL
   |
LL |     pub const fn get_mut<I: ~const SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> {
   |                             ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_mut`

error[E0277]: the type `str` cannot be indexed by `{integer}`
  --> $DIR/str-mut-idx.rs:11:25
   |
LL |     s.get_unchecked_mut(1);
   |       ----------------- ^ string indices are ranges of `usize`
   |       |
   |       required by a bound introduced by this call
   |
   = help: the trait `SliceIndex<str>` is not implemented for `{integer}`
   = note: you can use `.chars().nth()` or `.bytes().nth()`
           for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
   = help: the trait `SliceIndex<[T]>` is implemented for `usize`
note: required by a bound in `core::str::<impl str>::get_unchecked_mut`
  --> $SRC_DIR/core/src/str/mod.rs:LL:COL
   |
LL |     pub const unsafe fn get_unchecked_mut<I: ~const SliceIndex<str>>(
   |                                              ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked_mut`

error[E0277]: the type `str` cannot be indexed by `char`
  --> $DIR/str-mut-idx.rs:13:7
   |
LL |     s['c'];
   |       ^^^ string indices are ranges of `usize`
   |
   = help: the trait `SliceIndex<str>` is not implemented for `char`
   = note: required because of the requirements on the impl of `Index<char>` for `str`

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0277`.