1. 29
  1.  

  2. 10

    Interesting new feature not mentioned in blog post: opt-level can be specified per dependency.

    [profile.dev.package.image]
    opt-level = 2
    

    So, tight loops in dependency will work fast in debug mode without having to set high opt-level globally for everything.

    1. 6

      Big fan of the relaxed orphan rule. That has gotten in my way many times. I’m now going to excise some newtypes from our codebase. And, if I’m not mistaken, the C ABI change will allow a lot of unsafe transmutes in FFI to be avoided, right?

      Congrats and thanks to everyone involved!

      1. 5

        Agreed, the strict orphan rules were something I also encounter frequently, this makes it possible to do the ‘correct’ thing, avoiding newtype wrappers.

        I also like that they redesigned the lock file format to avoid conflicts. A practical change that really makes everyone’s love’s easy.

        Rust now really seems to be in a phase of very gradual refinements to reduce/remove papercuts. I love it!

        1. 1

          https://twitter.com/TJCarpenterShow/status/1222526307247878144?s=19

          They just released async await, a huge new language feature!

        2. 1

          It was and remains incorrect to transmute between Box<T> and *mut T. This just avoids having to use Box::from_raw() and Box::into_raw() at the FFI boundary.

          1. 1

            On the FFI front, yeah it looks like we doing need to do the basic dance of immediately wrapping C pointers. It looks like the guidance here is to only do it on Rust functions exposed to C and not the other way around.

            I’m sure there are a whole bunch of caveats, but I’m thinking if the memory is owned by rust and passed to C and then passed back into Rust, we don’t have any concerns around alignment and other initialization issues. If the memory is allocated by C, don’t use this technique.

          2. 1

            The Result::map_or and Result::map_or_else methods were stabilized.

            Looks like

            • Result::contains,
            • Result::contains_err and
            • Options::contains

            didn’t make the cut sadly. :-/