6 ms·
The big thing in this one is the LLVM upgrade, which has been a long time coming. :) We actually skipped LLVM 5 entirely due to some issues with emscripten. It'
by kibwen 9y ago
The big thing in this one is the LLVM upgrade, which has been a long time coming. :) We actually skipped LLVM 5 entirely due to some issues with emscripten. It'll be great to finally be able to experiment with LLD.
Looking forward, the next two releases, 1.26 and 1.27, are going to have some major features that we've been working on for a long, long time, such as "impl trait" (which should allow for improved performance, simpler syntax for the typical use of generics, and greatly improve error messages for extensive use of generics), more ergonomic matching when dealing with references, 128-bit integers, stable SIMD library support, and others. This whole year is going to see the continued stabilization of the ergonomics intiatives from last year, so stay tuned for lots of welcome tweaks to make Rust easier to write and read. :)
(I should also mention that this release happened live from the Rust All-Hands happening in Berlin, which has been a massively productive time so far; keep an eye out for the eventual workweek recap which will hopefully enumerate the tons of improvements (e.g. reducing Rust binary sizes by 10%) and future initiatives (e.g. forming an official Verification Team) that have happened this week.)
- cies 9y agoI love this focus on ergonomics in the Rust community. Recently I had to work with a Rust code base and I was amazed by how clean the tooling is compared to other low-level language stacks (C, C++ basically).
- simias 9y ago>stable SIMD library support Oh, that's a huge one for me and I didn't even know it was in the pipeline, very happy to hear that. Now I'll have to complain about lack of stable inline ASM support instead!
- steveklabnik 9y agoYou can check it out in nightly here https://doc.rust-lang.org/nightly/std/arch/ https://doc.rust-lang.org/nightly/std/arch/ > Now I'll have to complain about lack of stable inline ASM support instead! This one is much, much harder.
- simias 9y ago>This one is much, much harder. I'm curious why that is, intuitively I'd have assumed that SIMD support would be trickier to stabilize (since you need a generic interface over a wide range of implementations) while inline ASM is pretty much "just copy-paste this bit of assembly in the middle of this function" which I assume is already something LLVM can do easily since it needs that for C/C++. Since nobody expects inline ASM to be portable you don't have to worry about making one single generic interface to it. What's the catch?
- burntsushi 9y agow.r.t. to SIMD, there are two prongs to it: * Platform dependent functions that match an upstream vendor's API. (Think __m128i and friends.) * Platform independent APIs that provide portable vector APIs. The former is necessary because the latter cannot ever hope to cover all use cases supported by CPUs. The latter is necessary because it can hit many use cases, and finding the optimal implementation for every operation for every permutation of platform (and every permutation of CPU feature on each platform) is a non-trivial task. So yeah, that is indeed a ton of work. However, LLVM does a lot of the heavy lifting for us, particularly with respect to the implementation of the portable API. "All" we have to do is define an API we're willing to stabilize in `std`. (Which is no easy task.) I'm less in touch with the inline ASM feature, but like most things, I expect it is much more complex than you're suggesting. You can read more about it on the tracking issue for inline ASM[1]. Remember, if we're stabilizing something, then we need to make sure it continues to work. If LLVM's doesn't uphold that guarantee, that we must necessarily provide our own interface that is stable. "Just expose LLVM's internals" is not really an acceptable answer, and it was in fact a large part of the SIMD effort (building APIs we can stabilize on top of what LLVM supports). I'd also like to note that the stabilization of the former piece above (platform dependent vendor intrinsics) eats into many of the use cases for inline ASM. Not all of course, but many. :-) [1] - https://github.com/rust-lang/rust/issues/29722 https://github.com/rust-lang/rust/issues/29722
- simias 9y agoVery insightful, thank you. Reading through the github discussion I'm also glad to see that there seems to be a consensus for not adopting gcc's atrocious inline ASM syntax...
- mrec 9y ago> It'll be great to finally be able to experiment with LLD. Was the lack of lld the only reason for the Windows installer to depend on the MSVC build tools, or are there others?
- steveklabnik 9y agoThere are others. If you want to compile C code to include in your project, you'll need those tools. LLD and link.exe aren't exactly at feature parity, etc. I'm most excited about LLD for hobby OS dev; with Rust and LLD it's now trivial to get going on any OS Rust supports. As a Windows user, I really appreciate it!
- mrec 9y ago> If you want to compile C code to include in your project, you'll need those tools. Just curious, but if you're already built on top of llvm, why not bundle clang for that? Licensing issues? I thought NCSA was pretty permissive.
- steveklabnik 9y agoThat works if you can actually compile the code yourself, I left out the "if you want to link to a pre-compiled library that was compiled with MSVC" case. Basically, MSVC is the default, standard way to access C code on the platform, so we work with it by default. We also provide other options if you want to do it other ways, through things like the GNU target.
- mrec 9y agoAh, gotcha. Thanks for clarifying.
- mathw 9y agoEvery release that doesn't have impl Trait is a bit of a disappointment, but I appreciate it has to be done right. So excited for that one single improvement, it's going to make many things so much easier. Especially working with Futures and Iterators.
- steveklabnik 9y agoWell, you've got six weeks to wait :)
- mathw 9y agoIt's in 1.26?? YES! YES! WOOOOO!!! That's basically my birthday present.
- steveklabnik 9y agoYup! In both argument and return positions; in trait methods isn't in yet. 1.26 and 1.27 are gonna be really big, I wasn't kidding :)
- eslaught 9y agoIs anyone keeping something like [1] up-to-date? It's nice to able to see what's coming up in the next releases, for those of us who don't follow Rust closely enough to navigate the issue soup. [1]: https://internals.rust-lang.org/t/rust-release-milestone-predictions/4591 https://internals.rust-lang.org/t/rust-release-milestone-pre...
- steveklabnik 9y agoNot in general, but for Rust 2018, the edition release, we have https://docs.google.com/spreadsheets/d/188xuIgrzGLCu68UKpRjcmpRZ0ytxe-HG_ClViBqFvbI/ https://docs.google.com/spreadsheets/d/188xuIgrzGLCu68UKpRjc... (note the tabs too) It is, of course, best-effort, and often guestimates, so please don't take it as gospel, but describes what we're trying to do. (There was already one situation where a mistake in the spreadsheet caused someone to be misled about when a feature is going to be available)
- pedrocr 9y ago>The big thing in this one is the LLVM upgrade, which has been a long time coming. This is great news. I just ran my usual benchmark and it seems a performance regression has been fixed and some performance added over that. I'm measuring the speed of loading a Sony A77 raw file in rawloader[1]. That includes TIFF parsing and then a tight loop that processes every pixel. Here's the version history: 1.17 - 95ms 1.18 - 80ms (-16%) 1.19 - 79ms (-16%) 1.20 - 80ms (-16%) 1.21 - 79ms (-17%) 1.22 - 79ms (-17%) 1.23 - 79ms (-17%) 1.24 - 84ms (-12%) 1.25 - 74ms (-22%) I believe the jump in 1.18 was LLVM 4.0 and now LLVM 6.0 is giving me a new performance jump. No idea what happened in 1.24 though but it seems to be fixed now. [1] https://github.com/pedrocr/rawloader/ https://github.com/pedrocr/rawloader/
- Buttons840 9y agoI'm out of the loop. How will "impl Trait" help with errors? Does it automatically improve errors, or just allow library authors to implement custom error or something?
- steveklabnik 9y agoConsider this code: fn foo_no(v: &[i32]) -> std::iter::Cloned<std::slice::Iter<i32>> { v.iter().cloned() } fn foo_impl<'a>(v: &'a [i32]) -> impl Iterator<Item=i32> + 'a { v.iter().cloned() } fn main() { let v = vec![1, 2, 3]; let () = foo_no(&v); let () = foo_impl(&v); } Given the let ()s, this will fail to compile for both. For the first, you get = note: expected type `std::iter::Cloned<std::slice::Iter<'_, i32>>` for the second, you get = note: expected type `impl std::iter::Iterator` The former gets longer and longer based on how many iterator chains you do, the latter will be the same no matter how many you add. It's also just generally way more clear, "I was expecting something implementing Iterator, and I didn't get it" vs "I was expecting this exact chain of nested iterators".
- Buttons840 9y agoOk. It looks like the new feature allows library authors to express their intentions with simpler code, and thus error messages will also be simpler. Looks good, thanks for taking the time to answer my question.
- steveklabnik 9y agoNo problem! It also does enable some other things too. For example, closures have a type that's not writable, so fn foo() -> impl Fn(i32) -> i32 { |x| x + 1 } can be written, since closures implement the Fn trait, but there's no way to write the type directly.
- mike-cardwell 9y agoCan you explain why an explicit lifetime is needed in foo_impl? I don't see a connection between the function argument lifetime and the return value lifetime, as the return value is a brand new object with cloned values... I realise I'm missing something fundamental here.