Rust 1.20 adds type-associated constants, a number of library stabilizations, and improved credential hiding in Cargo.
Rust 1.20 adds type-associated constants, a number of library stabilization, and improved credential hiding in Cargo.
Rust 1.20 allows now to define constants associated to traits, structs, and enums. For example, the following snippet defines an ID constant that is not associated to any particular instance and can be used as Struct: : ID:
When defining an associated constant for a trait, you are not required to define a value for it, letting the concrete trait implementation do it:
Additionally, Rust 1.20 fixes a number of bugs that affected macros, specifically by attempting to predict whether a token can be matched against a fragment specifier. The Rust compiler has also been improved by improving type coercion within structs, enabling the LLVM WebAssembly backend, improving error messages, and more.
On the standard library front, Rust 1.20 introduced a number of improvements and stabilizations:
Finally, Rust package manager Cargo now stores the crates.io authentication token in a separate file, named ~/.cargo/credentials, which can be properly protected from other users attempting to access it.
To get the full detail of what is new in Rust 1.20, do not forget to read the release notes .