While working on the translation of the HTML parser from Java to Rust, I noticed this does not compile in Rust 0.4: fn main() { let c: u8 = 0x20; match c { ' ' => { io::println("Space"); } } return; }
I can make the translator generate integer literals as the patterns for the arms of the match. However, I think the generated Rust code would be nicer for humans to read with char literals in the patterns. I suggest allowing char literals when matching on an integer (or when otherwise comparing to an integer or when assigning to an integer variable) as long as the Unicode code point of the character represented by the character literal is not greater than the largest integer representable by the integer type. (Aside: I liked the old syntax without => and with mandatory braces around each arm better.) -- Henri Sivonen hsivo...@iki.fi http://hsivonen.iki.fi/ _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev