mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
![]() Allow int literals for pattern types with int base types r? ``@BoxyUwU`` I also added an error at layout computation time for layouts that contain wrapping ranges (happens at monomorphization time). This is obviously hacky, but at least prevents such types from making it to codegen for now. It made writing the tests for int literals easier as I didn't have to think about that edge case Basically this PR allows you to stop using transmutes for creating pattern types and instead just use literals: ```rust let x: pattern_type!(u32 is 5..10) = 7; ``` works, and if the literal is out of range you get a type mismatch because it just stays at the base type and the base type can't be coerced to the pattern type. cc ``@joshtriplett`` ``@scottmcm`` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
messages.ftl |