diff --git a/_posts/2017-08-31-Rust-1.20.md b/_posts/2017-08-31-Rust-1.20.md index a757602e3..6d651a5a7 100644 --- a/_posts/2017-08-31-Rust-1.20.md +++ b/_posts/2017-08-31-Rust-1.20.md @@ -5,7 +5,7 @@ author: The Rust Core Team --- The Rust team is happy to announce the latest version of Rust, 1.20.0. Rust -is a fast, fearless, and friendly programming language. +is a systems programming language focused on safety, speed, and concurrency. If you have a previous version of Rust installed, getting Rust 1.20 is as easy as: @@ -22,7 +22,7 @@ appropriate page on our website, and check out the [detailed release notes for ### What's in 1.20.0 stable -In Rust, you can define traits, structs, and enums that have "associated functions": +In Rust, you can already define traits, structs, and enums that have "associated functions": ```rust struct Struct; @@ -38,7 +38,7 @@ fn main() { } ``` -These are called "associated functions" becuase they are functions that are +These are called "associated functions" because they are functions that are associated with the type, that is, they're attached to the type itself, and not any particular instance. @@ -143,13 +143,10 @@ front in the future. [RFC 195]: https://github.com/rust-lang/rfcs/blob/master/text/0195-associated-items.md -Back in [Rust 1.14], we announced preliminary support for asm.js and wasm -with the help of Emscripten. Since then, LLVM has added its own support, and -so, we have [added native wasm support to Rust]! It's using the -`wasm32-experimental-emscripten` target. +We've also [fixed a bug] with the `include!` macro in documentation tests: for relative +paths, it erroneously was relative to the working directory, rather than to the current file. -[Rust 1.14]: https://blog.rust-lang.org/2016/12/22/Rust-1.14.html -[added native wasm support to Rust]: https://github.com/rust-lang/rust/pull/42571 +[fixed a bug]: https://github.com/rust-lang/rust/pull/43782 See the [detailed release notes][notes] for more. @@ -168,12 +165,60 @@ We [upgraded to Unicode 10.0.0](https://github.com/rust-lang/rust/pull/42999). Rust](https://github.com/rust-lang/rust/pull/42430), no longer relying on `cmath`. -We now [skip the main thread's manual stack guard on -Linux](https://github.com/rust-lang/rust/pull/43072), due to mitigations in -the kernel against [Stack -Clash](https://access.redhat.com/security/vulnerabilities/stackguard). +We are shipping mitigations against [Stack +Clash](https://access.redhat.com/security/vulnerabilities/stackguard) in this +release, notably, [stack probes], and [skipping the main thread's manual +stack guard on Linux]. You don't need to do anything to get these protections +other than using Rust 1.20. + +[stack probes]: https://github.com/rust-lang/rust/pull/42816 +[skipping the main thread's manual stack guard on Linux]: (https://github.com/rust-lang/rust/pull/43072) + +We've added a new trio of sorting functions to the standard library: +[`slice::sort_unstable_by_key`], [`slice::sort_unstable_by`], and +[`slice::sort_unstable`]. You'll note that these all have "unstable" in the name. +Stability is a property of sorting algorithms that may or may not matter to you, +but now you have both options! Here's a brief summary: imagine we had a list +of words like this: + +```text +rust +crate +package +cargo +``` + +Two of these words, `cargo` and `crate`, both start with the letter `c`. A stable +sort that sorts only on the first letter must produce this result: + +```text +crate +cargo +rust +package +``` + +That is, becuase `crate` came before `cargo` in the original list, it must also be +before it in the final list. An unstable sort could provide this result, but could +also give this answer too: + +```text +cargo +crate +rust +package +``` + +That is, the results *may* not be in the same original order. + +As you might imagine, less constraints often means faster results. If you don't care +about stability, these sorts may be faster for you than the stable variants. As always, +best to check both and see! These functions were added by [RFC 1884], if you'd like +more details, including benchmarks. + +[RFC 1884]: https://github.com/rust-lang/rfcs/blob/master/text/1884-unstable-sort.md -The following APIs were also stabilized: +Additionally, the following APIs were also stabilized: - [`CStr::into_c_string`] - [`CString::as_c_str`] and [`CString::into_boxed_c_str`] @@ -188,7 +233,6 @@ The following APIs were also stabilized: - [`f32::from_bits`] and [`f32::to_bits`] - [`f64::from_bits`] and [`f64::to_bits`] - [`mem::ManuallyDrop`] -- [`slice::sort_unstable_by_key`], [`slice::sort_unstable_by`], and [`slice::sort_unstable`] - [`str::from_boxed_utf8_unchecked`] - [`str::as_bytes_mut`] - [`str::from_utf8_mut`] and [`str::from_utf8_unchecked_mut`] @@ -237,9 +281,8 @@ See the [detailed release notes][notes] for more. Cargo has some nice upgrades this release. First of all, your crates.io authentication token used to be stored in `~/.cargo/config`. As a configuration file, this would often be stored with `644` permissions, that is, world-readable. -But it has a secret token in it. We've [moved the token] `~/.cargo/credentials`, +But it has a secret token in it. We've [moved the token] to `~/.cargo/credentials`, so that it can be permissioned `600`, and hidden from other users on your system. -You'll get a warning if it's still in your `~/.cargo/config`. [moved the token]: https://github.com/rust-lang/cargo/pull/3978