|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "Announcing Rust 1.47.0" |
| 4 | +author: The Rust Release Team |
| 5 | +release: true |
| 6 | +--- |
| 7 | + |
| 8 | +The Rust team is happy to announce a new version of Rust, 1.47.0. Rust is a |
| 9 | +programming language that is empowering everyone to build reliable and |
| 10 | +efficient software. |
| 11 | + |
| 12 | +If you have a previous version of Rust installed via rustup, getting Rust |
| 13 | +1.47.0 is as easy as: |
| 14 | + |
| 15 | +```console |
| 16 | +rustup update stable |
| 17 | +``` |
| 18 | + |
| 19 | +If you don't have it already, you can [get `rustup`][install] from the |
| 20 | +appropriate page on our website, and check out the [detailed release notes for |
| 21 | +1.47.0][notes] on GitHub. |
| 22 | + |
| 23 | +[install]: https://www.rust-lang.org/tools/install |
| 24 | +[notes]: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1470-2020-10-08 |
| 25 | + |
| 26 | +## What's in 1.47.0 stable |
| 27 | + |
| 28 | +This release contains no new significant features, and is mostly qualitify of |
| 29 | +life improvements, library stabilizations and const-ifications, and toolchain |
| 30 | +improvements. See the [detailed release notes][notes] to learn about other |
| 31 | +changes not covered by this post. |
| 32 | + |
| 33 | +#### Shorter backtraces |
| 34 | + |
| 35 | +Back in Rust 1.18, we [made some changes to the backtraces `rustc` would |
| 36 | +print on panic](https://github.com/rust-lang/rust/pull/38165). There are a |
| 37 | +number of things in a backtrace that aren't useful the majority of the time. |
| 38 | +However, at some point, [these |
| 39 | +regressed](https://github.com/rust-lang/rust/issues/47429). In Rust 1.47.0, |
| 40 | +the culprit was found, and [this has now been |
| 41 | +fixed](https://github.com/rust-lang/rust/pull/75048). Since the regression, |
| 42 | +this program: |
| 43 | + |
| 44 | +```rust |
| 45 | +fn main() { |
| 46 | + panic!(); |
| 47 | +} |
| 48 | +``` |
| 49 | + |
| 50 | +would give you a backtrace that looks like this: |
| 51 | + |
| 52 | +```text |
| 53 | +thread 'main' panicked at 'explicit panic', src/main.rs:2:5 |
| 54 | +stack backtrace: |
| 55 | + 0: backtrace::backtrace::libunwind::trace |
| 56 | + at /cargo/registry/src/i.8713187.xyz-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86 |
| 57 | + 1: backtrace::backtrace::trace_unsynchronized |
| 58 | + at /cargo/registry/src/i.8713187.xyz-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66 |
| 59 | + 2: std::sys_common::backtrace::_print_fmt |
| 60 | + at src/libstd/sys_common/backtrace.rs:78 |
| 61 | + 3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt |
| 62 | + at src/libstd/sys_common/backtrace.rs:59 |
| 63 | + 4: core::fmt::write |
| 64 | + at src/libcore/fmt/mod.rs:1076 |
| 65 | + 5: std::io::Write::write_fmt |
| 66 | + at src/libstd/io/mod.rs:1537 |
| 67 | + 6: std::sys_common::backtrace::_print |
| 68 | + at src/libstd/sys_common/backtrace.rs:62 |
| 69 | + 7: std::sys_common::backtrace::print |
| 70 | + at src/libstd/sys_common/backtrace.rs:49 |
| 71 | + 8: std::panicking::default_hook::{{closure}} |
| 72 | + at src/libstd/panicking.rs:198 |
| 73 | + 9: std::panicking::default_hook |
| 74 | + at src/libstd/panicking.rs:217 |
| 75 | + 10: std::panicking::rust_panic_with_hook |
| 76 | + at src/libstd/panicking.rs:526 |
| 77 | + 11: std::panicking::begin_panic |
| 78 | + at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/libstd/panicking.rs:456 |
| 79 | + 12: playground::main |
| 80 | + at src/main.rs:2 |
| 81 | + 13: std::rt::lang_start::{{closure}} |
| 82 | + at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/libstd/rt.rs:67 |
| 83 | + 14: std::rt::lang_start_internal::{{closure}} |
| 84 | + at src/libstd/rt.rs:52 |
| 85 | + 15: std::panicking::try::do_call |
| 86 | + at src/libstd/panicking.rs:348 |
| 87 | + 16: std::panicking::try |
| 88 | + at src/libstd/panicking.rs:325 |
| 89 | + 17: std::panic::catch_unwind |
| 90 | + at src/libstd/panic.rs:394 |
| 91 | + 18: std::rt::lang_start_internal |
| 92 | + at src/libstd/rt.rs:51 |
| 93 | + 19: std::rt::lang_start |
| 94 | + at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/libstd/rt.rs:67 |
| 95 | + 20: main |
| 96 | + 21: __libc_start_main |
| 97 | + 22: _start |
| 98 | +``` |
| 99 | + |
| 100 | +Now, in Rust 1.47.0, you'll see this instead: |
| 101 | + |
| 102 | +```text |
| 103 | +thread 'main' panicked at 'explicit panic', src/main.rs:2:5 |
| 104 | +stack backtrace: |
| 105 | + 0: std::panicking::begin_panic |
| 106 | + at /rustc/d6646f64790018719caebeafd352a92adfa1d75a/library/std/src/panicking.rs:497 |
| 107 | + 1: playground::main |
| 108 | + at ./src/main.rs:2 |
| 109 | + 2: core::ops::function::FnOnce::call_once |
| 110 | + at /rustc/d6646f64790018719caebeafd352a92adfa1d75a/library/core/src/ops/function.rs:227 |
| 111 | +``` |
| 112 | + |
| 113 | +This makes it much easier to see where the panic actually originated, and |
| 114 | +you can still set `RUST_BACKTRACE=full` if you want to see everything. |
| 115 | + |
| 116 | +#### LLVM 11 |
| 117 | + |
| 118 | +We have [upgraded to LLVM 11](https://github.com/rust-lang/rust/pull/73526/). |
| 119 | +The compiler still supports being compiled with LLVM versions as old as 8, |
| 120 | +but by default, 11 is what you'll be getting. |
| 121 | + |
| 122 | +#### Control Flow Guard on Windows |
| 123 | + |
| 124 | +`rustc` [now supports](https://github.com/rust-lang/rust/pull/73893/) `-C |
| 125 | +control-flow-guard`, an option that will turn on [Control Flow |
| 126 | +Guard](https://docs.microsoft.com/en-us/windows/win32/secbp/control-flow-guard) |
| 127 | +on Windows. Other platforms ignore this flag. |
| 128 | + |
| 129 | +### Library changes |
| 130 | + |
| 131 | +Nine new APIs were stabilized this release: |
| 132 | + |
| 133 | +- [`Ident::new_raw`] |
| 134 | +- [`Range::is_empty`] |
| 135 | +- [`RangeInclusive::is_empty`] |
| 136 | +- [`Result::as_deref`] |
| 137 | +- [`Result::as_deref_mut`] |
| 138 | +- [`Vec::leak`] |
| 139 | +- [`pointer::offset_from`] |
| 140 | +- [`f32::TAU`] |
| 141 | +- [`f64::TAU`] |
| 142 | + |
| 143 | +Additonally, the following previously stable APIs have now been made `const`: |
| 144 | + |
| 145 | +- [The `new` method for all `NonZero` integers.][73858] |
| 146 | +- [The `checked_add`,`checked_sub`,`checked_mul`,`checked_neg`, `checked_shl`, |
| 147 | + `checked_shr`, `saturating_add`, `saturating_sub`, and `saturating_mul` |
| 148 | + methods for all integers.][73858] |
| 149 | +- [The `checked_abs`, `saturating_abs`, `saturating_neg`, and `signum` for all |
| 150 | + signed integers.][73858] |
| 151 | +- [The `is_ascii_alphabetic`, `is_ascii_uppercase`, `is_ascii_lowercase`, |
| 152 | + `is_ascii_alphanumeric`, `is_ascii_digit`, `is_ascii_hexdigit`, |
| 153 | + `is_ascii_punctuation`, `is_ascii_graphic`, `is_ascii_whitespace`, and |
| 154 | + `is_ascii_control` methods for `char` and `u8`.][73858] |
| 155 | + |
| 156 | +[`Ident::new_raw`]: https://doc.rust-lang.org/nightly/proc_macro/struct.Ident.html#method.new_raw |
| 157 | +[`Range::is_empty`]: https://doc.rust-lang.org/nightly/std/ops/struct.Range.html#method.is_empty |
| 158 | +[`RangeInclusive::is_empty`]: https://doc.rust-lang.org/nightly/std/ops/struct.RangeInclusive.html#method.is_empty |
| 159 | +[`Result::as_deref_mut`]: https://doc.rust-lang.org/nightly/std/result/enum.Result.html#method.as_deref_mut |
| 160 | +[`Result::as_deref`]: https://doc.rust-lang.org/nightly/std/result/enum.Result.html#method.as_deref |
| 161 | +[`TypeId::of`]: https://doc.rust-lang.org/nightly/std/any/struct.TypeId.html#method.of |
| 162 | +[`Vec::leak`]: https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#method.leak |
| 163 | +[`f32::TAU`]: https://doc.rust-lang.org/nightly/std/f32/consts/constant.TAU.html |
| 164 | +[`f64::TAU`]: https://doc.rust-lang.org/nightly/std/f64/consts/constant.TAU.html |
| 165 | +[73858]: https://github.com/rust-lang/rust/pull/73858/ |
| 166 | + |
| 167 | +See the [detailed release notes][notes] for more. |
| 168 | + |
| 169 | +### Other changes |
| 170 | + |
| 171 | +[relnotes-cargo]: https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-147-2020-10-08 |
| 172 | +[relnotes-clippy]: https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-147 |
| 173 | + |
| 174 | +There are other changes in the Rust 1.47.0 release: check out what changed in |
| 175 | +[Rust][notes], [Cargo][relnotes-cargo], and [Clippy][relnotes-clippy]. |
| 176 | + |
| 177 | +## Contributors to 1.47.0 |
| 178 | + |
| 179 | +Many people came together to create Rust 1.47.0. We couldn't have done it |
| 180 | +without all of you. [Thanks!](https://thanks.rust-lang.org/rust/1.47.0/) |
0 commit comments