David's Blog

Catching up on Rust 1.41 and 1.42

Rust 1.41 relaxed restrictions on impl traits

The other day I was working on a small web project (more on this soon) and was using Warp. I wanted to impl some From<T> conversions for certain error types into my custom type to make error handling a little less clunky. I ran into some problems with doing that and I must not have realized it at the time but I believe I was on Rust 1.40. I saw this morning that Rust 1.41 relaxed some of those restrictions so that you can implement traits on foreign types as long as the trait is local to your crate. While this didn’t help my particular case, I might’ve been able to use it if I refactoring things around.

Rust 1.42 added some nice pattern matching improvements

I also noticed that Rust 1.42 had already been released as well (March 12th). It seems to have brought some nice improvements to pattern matching including allowing subslices in a slice pattern and the matches! macro. The former would probably be useful in the type of byte matching I was working with recently in my photo sorting tool (see part 1, part 2 coming soon).

I guess it’s time for me to subscribe to the [Rust blog](https://blog.rust-lang.org/) in my Newsblur account!