Rust 1.35.0 Released

Rust 1.35 rolled out, bringing Fn* closure traits implementation for Box

The Rust team recently announced the new version of Rust, 1.35.0.
Rust 1.35, brings the implementation of the FnOnce, FnMut, and Fn closure traits for Box<dyn FnOnce>, Box<dyn FnMut>, and Box<dyn Fn>.
With 1.35, closures can now be coerced to unsafe function pointers and the dbg! macro introduced in Rust 1.32.0 can now be called without arguments.
User that have a previous version of Rust installed via rustup, can get the update using: $ rustup update stable
With Rust 1.35.0, you can now use boxed functions in places that expect items implementing a function trait.
  1. fn foo(x: Box<dyn Fn(u8) -> u8>) -> Vec<u8> {  
  2. vec![1, 2, 3, 4].into_iter().map(x).collect()  
  3. }  
  4. //Furthermore, you can now directly call Box<dyn FnOnce> objects:  
  5. fn foo(x: Box<dyn FnOnce()>) {  
  6. x()  
  7. }  
Source: Rust
Closures can now be coerced to unsafe function pointers, as demonstrated below:
  1. /// The safety invariants are those of the `unsafe fn` pointer passed.  
  2. unsafe fn call_unsafe_fn_ptr(f: unsafe fn()) {  
  3. f()  
  4. }  
  6. fn main() {  
  7. // SAFETY: There are no invariants.  
  8. // The closure is statically prevented from doing unsafe things.  
  9. unsafe {  
  10. call_unsafe_fn_ptr(|| {  
  11. dbg!();  
  12. });  
  13. }  
  14. }  
Source: Rust 
According to the company, with this release, a number of APIs have become stable. And, some new implementations were also added.
You can now implement the following easily:
  • 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
  • Hash a pointer or reference by address, not value
  • Copy the contents of an Option<&T>
To see a complete list of changes, visit the release notes here.