Programming

Rust 1.35.0 released

2 min read

Yesterday, the Rust team announced the release of Rust 1.35.0. This release highlights the implementation of Fn* closure traits for Box<dyn Fn*>. Additionally it has features like coercing closures which are extended to unsafe fn pointers, dbg! macro can now be called without passing any arguments, a number of APIs have become stable and many more.

Key features explained in brief:

Fn* closure traits implemented for Box<dyn Fn*>

In Rust 1.35.0, the FnOnce, FnMut, and the Fn traits are now implemented for Box<dyn FnOnce>, Box<dyn FnMut>, and Box<dyn Fn> respectively. This allows users to use boxed functions in places where a function is to be implemented. It is also now possible to directly call Box<dyn FnOnce> objects.

Coercing closures to unsafe function pointers

In the earlier versions, it was possible to coerce closures which do not capture from the environment, into function pointers only . With this release, coercing closures has been extended to ‘unsafe’ function pointers also.

Calling dbg!() with no argument

dbg!()’ macro allows to quickly inspect the value of some expression with context. Now, users can call dbg!() without passing any arguments. This is useful in tracing what branch your application will take.

Library stabilizations

In 1.35.0, a number of APIs have become stable. Few new implementations and other changes have also been made. Some are mentioned below:

  • Copy the sign of a floating point number onto another
  • Check whether a Range contains a value
  • Map and split a borrowed RefCell value in two
  • Replace the value of a RefCell through a closure
  • Hash a pointer or reference by address, not value
  • Copy the contents of an Option<&T>

To know more about the changes in Library, head over to the release notes page.

Changes in Clippy

Clippy is a collection of lints to catch common mistakes and improve the Rust code. In this release of Rust, a new lint ‘drop_bounds’ has been added. Also Clippy has split the lintredundant_closure into redundant_closure and redundant_closure_for_method_calls.

Changes in Cargo

  • When passing a test filter, such as ‘cargo test foo’, the user does not have to build examples (unless they set test = true).
  • rustc-cdylib-link-arg’ key has been added to build scripts to specify linker arguments for cdylib crates.
  • Cargo clippy-preview’ is now a built-in cargo command.
  • The verification step in ‘cargo package’ that checks if any files are modified is now stricter. It uses a hash of the contents instead of checking file system mtimes. It also checks all files in the package.

To know more about the changes in Cargo, head over to the release notes page.

Read more about the Rust 1.35.0 announcement on the official Rust blog.

Read More

Rust’s recent releases 1.34.0 and 1.34.1 affected from vulnerability that can cause memory unsafety

Rust 1.34 releases with alternative cargo registries, stabilized TryFrom and TryInto, and more

Rust shares roadmap for 2019

Vincy Davis

A born storyteller turned writer!

Share
Published by
Vincy Davis

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago