Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon

Rust 1.35.0 released

Save for later
  • 3 min read
  • 24 May 2019

article-image

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>
  • Unlock access to the largest independent learning library in Tech for FREE!
    Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
    Renews at $19.99/month. Cancel anytime


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 a 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