Skip to content

Instantly share code, notes, and snippets.

@erszcz
Created October 7, 2014 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erszcz/da0cdc6cd2964e5d03a3 to your computer and use it in GitHub Desktop.
Save erszcz/da0cdc6cd2964e5d03a3 to your computer and use it in GitHub Desktop.
Rust bug in Unicode handling?
00:25:30 erszcz @ x2 : /tmp
$ cat zoladz.rs
fn main() {
let z = "żołądź";
println!("{:c}", z.char_at(1));
}
00:25:33 erszcz @ x2 : /tmp
$ rustc zoladz.rs
00:25:37 erszcz @ x2 : /tmp
$ ./zoladz
task '<main>' failed at 'assertion failed: (w != 0)', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libcore/str.rs:2059
00:25:38 erszcz @ x2 : /tmp
$ rustc --version
rustc 0.12.0-nightly (b5ba2f551 2014-10-06 20:27:14 +0000)
fn main() {
let z = "żołądź";
println!("{:c}", z.char_at(1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment