Skip to content

Commit d72c307

Browse files
Add E0134 error explanation
1 parent 18848ca commit d72c307

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/librustc/diagnostics.rs

+19-1
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,24 @@ fn main() {
411411
See also https://doc.rust-lang.org/book/unsafe.html
412412
"##,
413413

414+
E0134: r##"
415+
You tried to modify the str type, which isn't allowed. Erroneous code
416+
example:
417+
418+
```
419+
let s = "salut";
420+
let c = &mut s[0..1]; // error: modification of string types is not
421+
// allowed
422+
```
423+
424+
I you want to modify an str, please use the String type. Example:
425+
426+
```
427+
let mut s = "salut";
428+
let mut c = s[0..1].to_owned(); // ok!
429+
```
430+
"##,
431+
414432
E0135: r##"
415433
You tried to modify the str type, which isn't allowed. Erroneous code
416434
example:
@@ -421,7 +439,7 @@ let c = &mut (*s)[0..1]; // error: modification of string types is not
421439
// allowed
422440
```
423441
424-
I you want to modify an str, please use the String type. Example:
442+
If you want to modify an str, please use the String type. Example:
425443
426444
```
427445
let mut s = "salut";

0 commit comments

Comments
 (0)