|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "Announcing Rust 1.23" |
| 4 | +author: The Rust Core Team |
| 5 | +--- |
| 6 | + |
| 7 | +The Rust team is happy to announce a new version of Rust, 1.23.0. Rust is a |
| 8 | +systems programming language focused on safety, speed, and concurrency. |
| 9 | + |
| 10 | +If you have a previous version of Rust installed via rustup, getting Rust |
| 11 | +1.23.0 is as easy as: |
| 12 | + |
| 13 | +```bash |
| 14 | +$ rustup update stable |
| 15 | +``` |
| 16 | + |
| 17 | +If you don't have it already, you can [get `rustup`][install] from the |
| 18 | +appropriate page on our website, and check out the [detailed release notes for |
| 19 | +1.23.0][notes] on GitHub. |
| 20 | + |
| 21 | +[install]: https://www.rust-lang.org/install.html |
| 22 | +[notes]: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1230-2018-01-04 |
| 23 | + |
| 24 | +## What's in 1.23.0 stable |
| 25 | + |
| 26 | +New year, new Rust! For our first improvement today, we now [avoid some unnecessary |
| 27 | +copies](https://github.com/rust-lang/rust/pull/45380) in certain situations. |
| 28 | +We've seen memory usage of using `rustc` to drop 5-10% with this change; it may |
| 29 | +be different with your programs. |
| 30 | + |
| 31 | +The documentation team has been on a long journey to move `rustdoc` to use |
| 32 | +[CommonMark]. Previously, `rustdoc` never guaranteed which markdown rendering |
| 33 | +engine it used, but we're finally committing to CommonMark. As part of this |
| 34 | +release, we render the documentation with our previous renderer, [Hoedown], |
| 35 | +but also render it with a CommonMark compliant renderer, and [warn if there |
| 36 | +are any differences]. There should be a way for you to modify the syntax you |
| 37 | +use to render correctly under both; we're not aware of any situations where |
| 38 | +this is impossible. Docs team member Guillaume Gomez has [written a blog post] |
| 39 | +showing some common differences and how to solve them. In a future release, |
| 40 | +we will switch to using the CommonMark renderer by default. This [warning |
| 41 | +landed in nightly in May of last year], and has been on by default [since |
| 42 | +October of last year], so many crates have already fixed any issues that |
| 43 | +they've found. |
| 44 | + |
| 45 | +[CommonMark]: http://commonmark.org/ |
| 46 | +[Hoedown]: https://github.com/hoedown/hoedown |
| 47 | +[warn if there are any differences]: https://github.com/rust-lang/rust/pull/45324 |
| 48 | +[written a blog post]: https://blog.guillaume-gomez.fr/articles/2017-09-18+New+rustdoc+rendering+common+errors |
| 49 | +[warning landed in nightly in May of last year]: https://github.com/rust-lang/rust/pull/41991 |
| 50 | +[since October of last year]: https://github.com/rust-lang/rust/pull/45324 |
| 51 | + |
| 52 | +In other documentation news, historically, Cargo's docs have been a bit strange. |
| 53 | +Rather than being on [https://doc.rust-lang.org][], they've been at [https://doc.crates.io][]. |
| 54 | +With this release, [that's changing](https://github.com/rust-lang/rust/pull/45692). |
| 55 | +You can now find Cargo's docs at [https://doc.rust-lang.org/cargo][]. Additionally, they've |
| 56 | +been converted to the same format as our other long-form documentation. We'll be |
| 57 | +adding a redirect from `doc.crates.io` to this page, and you can expect to see more |
| 58 | +improvements and updates to Cargo's docs throughout the year. |
| 59 | + |
| 60 | +See the [detailed release notes][notes] for more. |
| 61 | + |
| 62 | +### Library stabilizations |
| 63 | + |
| 64 | +As of Rust 1.0, a trait named [`AsciiExt`] existed to provide ASCII related functionality |
| 65 | +on `u8`, `char`, `[u8]`, and `str`. To use it, you'd write code like this: |
| 66 | + |
| 67 | +```rust |
| 68 | +use std::ascii::AsciiExt; |
| 69 | + |
| 70 | +let ascii = 'a'; |
| 71 | +let non_ascii = '❤'; |
| 72 | +let int_ascii = 97; |
| 73 | + |
| 74 | +assert!(ascii.is_ascii()); |
| 75 | +assert!(!non_ascii.is_ascii()); |
| 76 | +assert!(int_ascii.is_ascii()); |
| 77 | +``` |
| 78 | + |
| 79 | +In Rust 1.23, these methods are now defined directly on those types, and so you no longer need |
| 80 | +to import the trait. Thanks to our stability guarantees, this trait still exists, so if you'd |
| 81 | +like to still support Rust versions before Rust 1.23, you can do this: |
| 82 | + |
| 83 | +```rust |
| 84 | +#[allow(unused_imports)] |
| 85 | +use std::ascii::AsciiExt; |
| 86 | +``` |
| 87 | + |
| 88 | +…to suppress the related warning. Once you drop support for older Rusts, you |
| 89 | +can remove both lines, and everything will continue to work. |
| 90 | + |
| 91 | +[`AsciiExt`]: https://doc.rust-lang.org/std/ascii/trait.AsciiExt.html |
| 92 | + |
| 93 | +Additionally, a few new APIs were stabilized this release: |
| 94 | + |
| 95 | +* The various [`std::sync::atomic |
| 96 | + types`](https://doc.rust-lang.org/std/sync/atomic/index.html#structs) |
| 97 | + now implement `From` their non-atomic types. For example, `let x = AtomicBool::from(true);`. |
| 98 | +* [`()` now implements `FromIterator<()>`](https://github.com/rust-lang/rust/pull/45379); check the PR for |
| 99 | + a neat use-case. |
| 100 | +* [`RwLock<T>` has had its `Send` restriction lifted](https://github.com/rust-lang/rust/pull/45682) |
| 101 | + |
| 102 | +See the [detailed release notes][notes] for more. |
| 103 | + |
| 104 | +### Cargo features |
| 105 | + |
| 106 | +`cargo check` can now [check your unit tests](https://github.com/rust-lang/cargo/pull/4592). |
| 107 | + |
| 108 | +`cargo uninstall` can now [uninstall more than one package in one command](https://github.com/rust-lang/cargo/pull/4561). |
| 109 | + |
| 110 | +See the [detailed release notes][notes] for more. |
| 111 | + |
| 112 | +## Contributors to 1.23.0 |
| 113 | + |
| 114 | +Many people came together to create Rust 1.23. We couldn't have done it |
| 115 | +without all of you. [Thanks!](https://thanks.rust-lang.org/rust/1.23.0) |
0 commit comments