Created
September 16, 2017 08:47
-
-
Save s9gf4ult/88b89dcdafd3befee041319a11bbe93a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let s = String::from("жопа"); | |
let t = & s[3..]; | |
println!("{}", s); | |
println!("{}", t); | |
} | |
// thread 'main' panicked at 'byte index 3 is not a char boundary; it is inside 'о' (bytes 2..4) of `жопа`', src/libcore/str/mod.rs:1771 | |
// note: Run with `RUST_BACKTRACE=1` for a backtrace. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Дык и чо?
Ну у многих языков так. У Julia так в точности, например. У Go скорее всего. Не во всех далеко строка — контейнер с символами. Меня и самого раздражает, но на практике слайс строки не так часто нужен.