Skip to content

Instantly share code, notes, and snippets.

@s9gf4ult
Created September 16, 2017 08:47
Show Gist options
  • Save s9gf4ult/88b89dcdafd3befee041319a11bbe93a to your computer and use it in GitHub Desktop.
Save s9gf4ult/88b89dcdafd3befee041319a11bbe93a to your computer and use it in GitHub Desktop.
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.
@dluciv
Copy link

dluciv commented Sep 16, 2017

Дык и чо?

Ну у многих языков так. У Julia так в точности, например. У Go скорее всего. Не во всех далеко строка — контейнер с символами. Меня и самого раздражает, но на практике слайс строки не так часто нужен.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment