2 ms·
0_0, 0__0, 0x_0, 0_ and 0_.0 are legal in Rust. 0._0 is the only one of those that’s illegal (“`{integer}` is a primitive type and therefore doesn't have fields
by chrismorgan 5y ago
0_0, 0__0, 0x_0, 0_ and 0_.0 are legal in Rust. 0._0 is the only one of those that’s illegal (“`{integer}` is a primitive type and therefore doesn't have fields”).
- Zababa 5y agoTo clarify the special case in Rust ( 0._0 ), it's due to te definition of identifiers: https://doc.bccnsoft.com/docs/rust-1.36.0-docs-html/reference/identifiers.html https://doc.bccnsoft.com/docs/rust-1.36.0-docs-html/referenc.... _0 is an identifier, as it's an underscore followed by one alphanumeric character. Thus, 0._0 means "the field _0 of 0". Since it's an identifier starting with _, you won't get any warnings if you don't use it. Small example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b91364d3e27acda95c094f8cedbb71a4 https://play.rust-lang.org/?version=stable&mode=debug&editio...