mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-01-23 15:40:27 +08:00
17 lines
529 B
Plaintext
17 lines
529 B
Plaintext
$ cargo run
|
|
Compiling collections v0.1.0 (file:///projects/collections)
|
|
error[E0277]: the type `String` cannot be indexed by `{integer}`
|
|
--> src/main.rs:3:13
|
|
|
|
|
3 | let h = s1[0];
|
|
| ^^^^^ `String` cannot be indexed by `{integer}`
|
|
|
|
|
= help: the trait `Index<{integer}>` is not implemented for `String`
|
|
|
|
error: aborting due to previous error
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|
|
error: could not compile `collections`
|
|
|
|
To learn more, run the command again with --verbose.
|