Update Sep 10, 2020 tracked by Updatify
Rust 1.40.0
Language
-
You can now use tuple
structs and tupleenumvariant’s constructors inconstcontexts. e.g.pub struct Point(i32, i32); const ORIGIN: Point = { let constructor = Point; constructor(0, 0) }; -
You can now mark
structs,enums, andenumvariants with the#[non_exhaustive]attribute to indicate that there may be variants or fields added in the future. For example this requires adding a wild-card branch (_ => {}) to any match statements on a non-exhaustiveenum. (RFC 2008) -
You can now use function-like procedural macros in
externblocks and in type positions. e.g.type Generated = macro!(); -
The
metapattern matcher inmacro_rules!now correctly matches the modern attribute syntax. For example(#[$m:meta])now matches#[attr],#[attr{tokens}],#[attr[tokens]], and#[attr(tokens)].