Rust Bloghttps://blog.rust-lang.org/Rust BlogEmpowering everyone to build reliable and efficient software.Maintained by the Rust Team.https://github.com/rust-lang/blog.rust-lang.org/2020-08-14T11:45:13+00:00Announcing Rust 1.45.22020-08-03T00:00:00+00:002020-08-03T00:00:00+00:00https://blog.rust-lang.org/2020/08/03/Rust-1.45.2.html<p>The Rust team is announcing a new version of Rust, 1.45.2. Rust is a
programming language that is empowering everyone to build reliable and
efficient software.</p>
<p>If you have a previous version of Rust installed via rustup, getting Rust
1.45.2 is as easy as:</p>
<pre><code class="language-console">rustup update stable
</code></pre>
<p>If you don't have it already, you can <a href="https://www.rust-lang.org/install.html">get <code>rustup</code></a> from the
appropriate page on our website, and check out the <a href="https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1452-2020-08-03">detailed release notes for
1.45.2</a> on GitHub.</p>
<h2><a href="#whats-in-1452-stable" aria-hidden="true" class="anchor" id="whats-in-1452-stable"></a>What's in 1.45.2 stable</h2>
<p>1.45.2 contains two fixes, one to 1.45.1 and the other to 1.45.0.</p>
<h2><a href="#track_caller-on-trait-objects" aria-hidden="true" class="anchor" id="track_caller-on-trait-objects"></a><code>#[track_caller]</code> on trait objects</h2>
<p>Trait objects with methods annotated with <code>#[track_caller]</code> would be
miscompiled. <code>#[track_caller]</code> is not yet stable on 1.45. However, the standard
library makes use of this on some traits for better error messages. Trait
objects of <code>SliceIndex</code>, <code>Index</code>, and <code>IndexMut</code> were affected by this bug.</p>
<h2><a href="#tuple-patterns-binding--to-an-identifier" aria-hidden="true" class="anchor" id="tuple-patterns-binding--to-an-identifier"></a>Tuple patterns binding <code>..</code> to an identifier</h2>
<p>In 1.45.1, we backported a fix for <a href="https://github.com/rust-lang/rust/issues/74539">#74539</a>, but this fix turned out to be
incorrect, causing other unrelated breakage. As such, this release reverts that
fix.</p>
<h2><a href="#contributors-to-1452" aria-hidden="true" class="anchor" id="contributors-to-1452"></a>Contributors to 1.45.2</h2>
<p>Many people came together to create Rust 1.45.2. We couldn't have done it
without all of you. <a href="https://thanks.rust-lang.org/rust/1.45.2/">Thanks!</a></p>
The Rust Release TeamAnnouncing Rust 1.45.12020-07-30T00:00:00+00:002020-07-30T00:00:00+00:00https://blog.rust-lang.org/2020/07/30/Rust-1.45.1.html<p>The Rust team is happy to announce a new version of Rust, 1.45.1. Rust is a
programming language that is empowering everyone to build reliable and
efficient software.</p>
<p>If you have a previous version of Rust installed via rustup, getting Rust
1.45.1 is as easy as:</p>
<pre><code class="language-console">rustup update stable
</code></pre>
<p>If you don't have it already, you can <a href="https://www.rust-lang.org/install.html">get <code>rustup</code></a> from the
appropriate page on our website, and check out the <a href="https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1451-2020-07-30">detailed release notes for
1.45.1</a> on GitHub.</p>
<h2><a href="#whats-in-1451-stable" aria-hidden="true" class="anchor" id="whats-in-1451-stable"></a>What's in 1.45.1 stable</h2>
<p>1.45.1 contains a collection of fixes, including one soundness fix. All patches
in 1.45.1 address bugs that affect only the 1.45.0 release; prior releases are
not affected by the bugs fixed in this release.</p>
<h3><a href="#fix-const-propagation-with-references" aria-hidden="true" class="anchor" id="fix-const-propagation-with-references"></a>Fix const propagation with references</h3>
<p>In Rust 1.45.0, <code>rustc</code>'s const propagation pass did not properly handle
encountering references when determining whether to propagate a given constant,
which could lead to incorrect behavior. Our releases are run through <a href="https://github.com/rust-lang/crater">crater</a>,
and we did not detect it, which helps us be fairly confident that this affects a
very small set of code in the wild (if any).</p>
<p>The conditions necessary to cause this bug are highly unlikely to occur in
practice: the code must have inputs consisting of entirely constant values and
no control flow or function calls in between.</p>
<pre><code class="language-rust">struct Foo {
x: u32,
}
fn main() {
let mut foo = Foo { x: 42 };
let x = &mut foo.x;
*x = 13;
let y = foo;
println!("{}", y.x); // -> 42; expected result: 13
}
</code></pre>
<h2><a href="#contributors-to-1451" aria-hidden="true" class="anchor" id="contributors-to-1451"></a>Contributors to 1.45.1</h2>
<p>Many people came together to create Rust 1.45.1. We couldn't have done it
without all of you. <a href="https://thanks.rust-lang.org/rust/1.45.1/">Thanks!</a></p>
The Rust Release TeamAnnouncing Rust 1.45.02020-07-16T00:00:00+00:002020-07-16T00:00:00+00:00https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html<p>The Rust team is happy to announce a new version of Rust, 1.45.0. Rust is a
programming language that is empowering everyone to build reliable and
efficient software.</p>
<p>If you have a previous version of Rust installed via rustup, getting Rust
1.45.0 is as easy as:</p>
<pre><code class="language-console">rustup update stable
</code></pre>
<p>If you don't have it already, you can <a href="https://www.rust-lang.org/install.html">get <code>rustup</code></a> from the
appropriate page on our website, and check out the <a href="https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1450-2020-07-16">detailed release notes for
1.45.0</a> on GitHub.</p>
<h2><a href="#whats-in-1450-stable" aria-hidden="true" class="anchor" id="whats-in-1450-stable"></a>What's in 1.45.0 stable</h2>
<p>There are two big changes to be aware of in Rust 1.45.0: a fix for some
long-standing unsoundness when casting between integers and floats, and the
stabilization of the final feature needed for one of the more popular web
frameworks to work on stable Rust.</p>
<h2><a href="#fixing-unsoundness-in-casts" aria-hidden="true" class="anchor" id="fixing-unsoundness-in-casts"></a>Fixing unsoundness in casts</h2>
<p><a href="https://github.com/rust-lang/rust/issues/10184">Issue 10184</a> was originally
opened back in October of 2013, a year and a half before Rust 1.0. As you may
know, <code>rustc</code> uses <a href="http://llvm.org/">LLVM</a> as a compiler backend. When you
write code like this:</p>
<pre><code class="language-rust">pub fn cast(x: f32) -> u8 {
x as u8
}
</code></pre>
<p>The Rust compiler in Rust 1.44.0 and before would produce LLVM-IR that looks
like this:</p>
<pre><code class="language-llvm-ir">define i8 @_ZN10playground4cast17h1bdf307357423fcfE(float %x) unnamed_addr #0 {
start:
%0 = fptoui float %x to i8
ret i8 %0
}
</code></pre>
<p>That <code>fptoui</code> implements the cast, it is short for "floating point to
unsigned integer."</p>
<p>But there's a problem here. From <a href="https://llvm.org/docs/LangRef.html#fptoui-to-instruction">the
docs</a>:</p>
<blockquote>
<p>The ‘fptoui’ instruction converts its floating-point operand into the
nearest (rounding towards zero) unsigned integer value. If the value cannot
fit in ty2, the result is a poison value.</p>
</blockquote>
<p>Now, unless you happen to dig into the depths of compilers regularly, you may
not understand what that means. It's full of jargon, but there's a simpler
explanation: if you cast a floating point number that's large to an integer
that's small, you get undefined behavior.</p>
<p>That means that this, for example, was not well-defined:</p>
<pre><code class="language-rust">fn cast(x: f32) -> u8 {
x as u8
}
fn main() {
let f = 300.0;
let x = cast(f);
println!("x: {}", x);
}
</code></pre>
<p>On Rust 1.44.0, this happens to print "x: 0" on my machine. But it could
print anything, or do anything: this is undefined behavior. But the <code>unsafe</code>
keyword is not used within this block of code. This is what we call a
"soundness" bug, that is, it is a bug where the compiler does the wrong thing.
We tag these bugs as
<a href="https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3A%22I-unsound+%F0%9F%92%A5%22">I-unsound</a>
on our issue tracker, and take them very seriously.</p>
<p>This bug took a long time to resolve, though. The reason is that it was very
unclear what the correct path forward was.</p>
<p>In the end, the decision was made to do this:</p>
<ul>
<li><code>as</code> would perform a "saturating cast".</li>
<li>A new <code>unsafe</code> cast would be added if you wanted to skip the checks.</li>
</ul>
<p>This is very similar to array access, for example:</p>
<ul>
<li><code>array[i]</code> will check to make sure that <code>array</code> has at least <code>i + 1</code> elements.</li>
<li>You can use <code>unsafe { array.get_unchecked(i) }</code> to skip the check.</li>
</ul>
<p>So, what's a saturating cast? Let's look at a slightly modified example:</p>
<pre><code class="language-rust">fn cast(x: f32) -> u8 {
x as u8
}
fn main() {
let too_big = 300.0;
let too_small = -100.0;
let nan = f32::NAN;
println!("too_big_casted = {}", cast(too_big));
println!("too_small_casted = {}", cast(too_small));
println!("not_a_number_casted = {}", cast(nan));
}
</code></pre>
<p>This will print:</p>
<pre><code class="language-text">too_big_casted = 255
too_small_casted = 0
not_a_number_casted = 0
</code></pre>
<p>That is, numbers that are too big turn into the largest possible value.
Numbers that are too small produce the smallest possible value (which is
zero). NaN produces zero.</p>
<p>The new API to cast in an unsafe manner is:</p>
<pre><code class="language-rust">let x: f32 = 1.0;
let y: u8 = unsafe { x.to_int_unchecked() };
</code></pre>
<p>But as always, you should only use this method as a last resort. Just like
with array access, the compiler can often optimize the checks away, making
the safe and unsafe versions equivalent when the compiler can prove it.</p>
<h2><a href="#stabilizing-function-like-procedural-macros-in-expressions-patterns-and-statements" aria-hidden="true" class="anchor" id="stabilizing-function-like-procedural-macros-in-expressions-patterns-and-statements"></a>Stabilizing function-like procedural macros in expressions, patterns, and statements</h2>
<p>In <a href="https://blog.rust-lang.org/2018/10/25/Rust-1.30.0.html">Rust 1.30.0</a>, we stabilized
"function-like procedural macros in item position." For example, <a href="https://gitlab.gnome.org/federico/gnome-class">the
<code>gnome-class</code> crate</a>:</p>
<blockquote>
<p>Gnome-class is a procedural macro for Rust. Within the macro, we
define a mini-language which looks as Rust-y as possible, and that has
extensions to let you define GObject subclasses, their properties,
signals, interface implementations, and the rest of GObject's
features. The goal is to require no unsafe code on your part.</p>
</blockquote>
<p>This looks like this:</p>
<pre><code class="language-rust">gobject_gen! {
class MyClass: GObject {
foo: Cell<i32>,
bar: RefCell<String>,
}
impl MyClass {
virtual fn my_virtual_method(&self, x: i32) {
... do something with x ...
}
}
}
</code></pre>
<p>The "in item position" bit is some jargon, but basically what this means is that
you could only invoke <code>gobject_gen!</code> in certain places in your code.</p>
<p>Rust 1.45.0 adds the ability to invoke procedural macros in three new places:</p>
<pre><code class="language-rust">// imagine we have a procedural macro named "mac"
mac!(); // item position, this was what was stable before
// but these three are new:
fn main() {
let expr = mac!(); // expression position
match expr {
mac!() => {} // pattern position
}
mac!(); // statement position
}
</code></pre>
<p>Being able to use macros in more places is interesting, but there's another
reason why many Rustaceans have been waiting for this feature for a long time:
<a href="https://rocket.rs">Rocket</a>. Initially released in December of 2016, Rocket is
a popular web framework for Rust often described as one of the best things the
Rust ecosystem has to offer. Here's the "hello world" example from its upcoming
release:</p>
<pre><code class="language-rust">#[macro_use] extern crate rocket;
#[get("/<name>/<age>")]
fn hello(name: String, age: u8) -> String {
format!("Hello, {} year old named {}!", age, name)
}
#[launch]
fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/hello", routes![hello])
}
</code></pre>
<p>Until today, Rocket depended on nightly-only features to deliver on its promise
of flexibility and ergonomics. In fact, as can be seen on the <a href="https://rocket.rs/v0.4">project's
homepage</a>, the same example above in the current version
of Rocket requires the <code>proc_macro_hygiene</code> feature to compile. However, as you
may guess from the feature's name, today it ships in stable! <a href="https://github.com/SergioBenitez/Rocket/issues/19">This
issue</a> tracked the history of
nightly-only features in Rocket. Now, they're all checked off!</p>
<p>This next version of Rocket is still in the works, but when released, many folks
will be very happy :)</p>
<h3><a href="#library-changes" aria-hidden="true" class="anchor" id="library-changes"></a>Library changes</h3>
<p>In Rust 1.45.0, the following APIs were stabilized:</p>
<ul>
<li><a href="https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.as_ptr"><code>Arc::as_ptr</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/std/collections/struct.BTreeMap.html#method.remove_entry"><code>BTreeMap::remove_entry</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.as_ptr"><code>Rc::as_ptr</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/std/rc/struct.Weak.html#method.as_ptr"><code>rc::Weak::as_ptr</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/std/rc/struct.Weak.html#method.from_raw"><code>rc::Weak::from_raw</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/std/rc/struct.Weak.html#method.into_raw"><code>rc::Weak::into_raw</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/std/primitive.str.html#method.strip_prefix"><code>str::strip_prefix</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/std/primitive.str.html#method.strip_suffix"><code>str::strip_suffix</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/std/sync/struct.Weak.html#method.as_ptr"><code>sync::Weak::as_ptr</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/std/sync/struct.Weak.html#method.from_raw"><code>sync::Weak::from_raw</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/std/sync/struct.Weak.html#method.into_raw"><code>sync::Weak::into_raw</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/std/char/constant.UNICODE_VERSION.html"><code>char::UNICODE_VERSION</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/proc_macro/struct.Span.html#method.resolved_at"><code>Span::resolved_at</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/proc_macro/struct.Span.html#method.located_at"><code>Span::located_at</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/proc_macro/struct.Span.html#method.mixed_site"><code>Span::mixed_site</code></a></li>
<li><a href="https://doc.rust-lang.org/std/os/unix/process/trait.CommandExt.html#tymethod.arg0"><code>unix::process::CommandExt::arg0</code></a></li>
</ul>
<p>Additionally, you can <a href="https://github.com/rust-lang/rust/pull/72413/">use <code>char</code> with
ranges</a>, to iterate over
codepoints:</p>
<pre><code class="language-rust">for ch in 'a'..='z' {
print!("{}", ch);
}
println!();
// Prints "abcdefghijklmnopqrstuvwxyz"
</code></pre>
<p>For a full list of changes, see <a href="https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1450-2020-07-16">the full release notes</a>.</p>
<h3><a href="#other-changes" aria-hidden="true" class="anchor" id="other-changes"></a>Other changes</h3>
<p>There are other changes in the Rust 1.45.0 release: check out what changed in
<a href="https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1450-2020-07-16">Rust</a>, <a href="https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-145-2020-07-16">Cargo</a>, and <a href="https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-145">Clippy</a>.</p>
<h2><a href="#contributors-to-1450" aria-hidden="true" class="anchor" id="contributors-to-1450"></a>Contributors to 1.45.0</h2>
<p>Many people came together to create Rust 1.45.0. We couldn't have done it
without all of you. <a href="https://thanks.rust-lang.org/rust/1.45.0/">Thanks!</a></p>
The Rust Release Teamcrates.io security advisory2020-07-14T00:00:00+00:002020-07-14T00:00:00+00:00https://blog.rust-lang.org/2020/07/14/crates-io-security-advisory.html<p>This is a cross-post of <a href="https://groups.google.com/forum/?oldui=1#!topic/rustlang-security-announcements/wc5d_Qq35RA">the official security advisory</a>. The official post
contains a signed version with our PGP key, as well.</p>
<hr />
<p>The Rust Security Response Working Group was recently notified of a security
issue affecting token generation in the <a href="https://crates.io">crates.io</a> web application, and while
investigated that issue we discovered an additional vulnerability affecting
crates.io API tokens.</p>
<p>We have no evidence of this being exploited in the wild, but out of an
abundance of caution we opted to revoke all existing API keys. You can generate
a new one at <a href="https://crates.io/me">crates.io/me</a>.</p>
<h2><a href="#overview" aria-hidden="true" class="anchor" id="overview"></a>Overview</h2>
<p>Until recently, API keys for <a href="https://crates.io">crates.io</a> were generated using the PostgreSQL
random function, which is not a cryptographically secure random number
generator. This means that in theory, an attacker could observe enough random
values to determine the internal state of the random number generator, and use
this information to determine previously created API keys up to the last
database server reboot.</p>
<p>As part of the investigation for this, we also found that API keys were being
stored in plain text. This would mean if our database were somehow compromised
the attacker would be have API access for all current tokens.</p>
<h2><a href="#mitigations" aria-hidden="true" class="anchor" id="mitigations"></a>Mitigations</h2>
<p>We deployed a code change to production to use a cryptographically secure
random number generator, and we implemented hashing for storing tokens in the
database.</p>
<p>Exploiting either issue would be incredibly impractical in practice, and we've
found no evidence of this being exploited in the wild. However, out of an
abundance of caution, we've opted to revoke all existing API keys. You can
generate a new API key by visiting <a href="https://crates.io/me">crates.io/me</a>. We apologize for any
inconvenience this causes.</p>
<h2><a href="#acknowledgements" aria-hidden="true" class="anchor" id="acknowledgements"></a>Acknowledgements</h2>
<p>Thanks to <a href="https://github.com/jsha">Jacob Hoffman-Andrews</a> for responsibly disclosing the random number
generator issue according to <a href="https://www.rust-lang.org/policies/security">our security policy</a>. Thanks to <a href="https://github.com/sgrif">Siân
Griffin</a> and <a href="https://github.com/jtgeibel">Justin Geibel</a> from the crates.io team for helping the Security
Response WG addressing both of the issues. Thanks to <a href="https://github.com/pietroalbini">Pietro Albini</a> from the
Security Response WG for coordinating the work on this vulnerability.</p>
<h2><a href="#timeline-of-events" aria-hidden="true" class="anchor" id="timeline-of-events"></a>Timeline of events</h2>
<p>All times are listed in UTC.</p>
<ul>
<li>2020-07-11 17:43 - The issue is reported to <a href="mailto:security@rust-lang.org">security@rust-lang.org</a></li>
<li>2020-07-11 20:56 - The issue is acknowledged, the leads of the crates.io team
are looped in</li>
<li>2020-07-11 23:48 - The issue is confirmed and a planned fix is agreed on</li>
<li>2020-07-13 08:00 - The development of the fix is started</li>
<li>2020-07-14 12:53 - The fix is tested on the staging environment</li>
<li>2020-07-14 19:03 - The fix is deployed, existing tokens are revoked, and the
issue is disclosed publicly</li>
</ul>
Rust Security Response WGAnnouncing Rustup 1.22.12020-07-08T00:00:00+00:002020-07-08T00:00:00+00:00https://blog.rust-lang.org/2020/07/08/Rustup-1.22.1.html<p>The rustup working group is happy to announce the release of rustup version 1.22.1. <a href="https://rustup.rs">Rustup</a> is the recommended tool to install <a href="https://www.rust-lang.org">Rust</a>, a programming language that is empowering everyone to build reliable and efficient software.</p>
<p>If you have a previous version of rustup installed, getting rustup 1.22.1 may be as easy as closing your IDE and running:</p>
<pre><code>rustup self update
</code></pre>
<p>Rustup will also automatically update itself at the end of a normal toolchain update:</p>
<pre><code>rustup update
</code></pre>
<p>If you don't have it already, or if the 1.22.0 release of rustup caused you to experience the problem that 1.22.1 fixes, you can <a href="https://rustup.rs">get rustup</a> from the appropriate page on our website.</p>
<h2><a href="#whats-new-in-rustup-1221" aria-hidden="true" class="anchor" id="whats-new-in-rustup-1221"></a>What's new in rustup 1.22.1</h2>
<p>When updating dependency crates for 1.22.0, a change in behaviour of the <code>url</code> crate slipped in which caused <code>env_proxy</code> to cease to work with proxy data set in the environment. This is unfortunate since those of you who use <code>rustup</code> behind a proxy and have updated to 1.22.0 will now find that rustup may not work properly for you.</p>
<p>If you are affected by this, simply <a href="https://rustup.rs">re-download the installer</a> and run it. It will update your existing installation of Rust with no need to uninstall first.</p>
<h2><a href="#thanks" aria-hidden="true" class="anchor" id="thanks"></a>Thanks</h2>
<p>Thanks to Ivan Nejgebauer who spotted the issue, provided the fix, and made rustup 1.22.1 possible,
and to Ben Chen who provided a fix for our website.</p>
The Rustup Working GroupAnnouncing Rustup 1.22.02020-07-06T00:00:00+00:002020-07-06T00:00:00+00:00https://blog.rust-lang.org/2020/07/06/Rustup-1.22.0.html<p>The rustup working group is happy to announce the release of rustup version 1.22.0. <a href="https://rustup.rs">Rustup</a> is the recommended tool to install <a href="https://www.rust-lang.org">Rust</a>, a programming language that is empowering everyone to build reliable and efficient software.</p>
<p>If you have a previous version of rustup installed, getting rustup 1.22.0 is as easy as closing your IDE and running:</p>
<pre><code>rustup self update
</code></pre>
<p>Rustup will also automatically update itself at the end of a normal toolchain update:</p>
<pre><code>rustup update
</code></pre>
<p>If you don't have it already, you can <a href="https://rustup.rs">get rustup</a> from the appropriate page on our website.</p>
<h2><a href="#whats-new-in-rustup-1220" aria-hidden="true" class="anchor" id="whats-new-in-rustup-1220"></a>What's new in rustup 1.22.0</h2>
<p>This release is mostly related to internal rework and tweaks in UI messages. It is effectively a quality-of-life update which includes things such as:</p>
<ul>
<li>Supporting the larger MIPS release files which now exceed 100MB in individual files</li>
<li>Supporting running in a lower-memory mode on single-CPU systems, along with detecting any in-place soft-limits on memory consumption in an effort to reduce the chance you run out of RAM during an install on systems like Raspberry Pis</li>
<li>When we skip a <code>nightly</code> for missing-component reasons we now tell you all the missing components</li>
<li>We now tell you where overrides are coming from in <code>rustup show</code></li>
<li>Added <code>riscv64gc-unknown-linux-gnu</code> version of <code>rustup</code></li>
<li>You can now specify multiple components when installing a toolchain more easily. For example, if you wanted to install nightly with the <code>default</code> profile, but add the IDE support all in one go, you can now run
<pre><code>rustup toolchain install --profile default --component rls,rust-analysis,rust-src nightly
</code></pre>
</li>
</ul>
<p>There are many more changes in 1.22.0, with around 90 PRs, though a large number of them are internal changes which you can look at in <a href="https://github.com/rust-lang/rustup/commits/master">Github</a> if you want, and you can see a little more detail than the above in our <a href="https://github.com/rust-lang/rustup/blob/stable/CHANGELOG.md#1220---2020-06-30">changelog</a>.</p>
<h2><a href="#thanks" aria-hidden="true" class="anchor" id="thanks"></a>Thanks</h2>
<p>Thanks to all the contributors who made rustup 1.22.0 possible!</p>
<ul>
<li>Alejandro Martinez Ruiz</li>
<li>Alexander D'hoore</li>
<li>Ben Chen</li>
<li>Chris Denton</li>
<li>Daniel Silverstone</li>
<li>Evan Weiler</li>
<li>Guillaume Gomez</li>
<li>Harry Sarson</li>
<li>Jacob Lifshay</li>
<li>James Yang</li>
<li>Joel Parker Henderson</li>
<li>John Titor</li>
<li>Jonas Platte</li>
<li>Josh Stone</li>
<li>Jubilee</li>
<li>Kellda</li>
<li>LeSeulArtichaut</li>
<li>Linus Färnstrand</li>
<li>LitoMore</li>
<li>LIU An (劉安)</li>
<li>Luciano Bestia</li>
<li>Lzu Tao</li>
<li>Manish Goregaokar</li>
<li>Mingye Wang</li>
<li>Montgomery Edwards</li>
<li>Per Lundberg</li>
<li>Pietro Albini</li>
<li>Robert Collins</li>
<li>Rudolf B.</li>
<li>Solomon Ucko</li>
<li>Stein Somers</li>
<li>Tetsuharu Ohzeki</li>
<li>Tom Eccles</li>
<li>Trevor Arjeski</li>
<li>Tshepang Lekhonkhobe</li>
</ul>
The Rustup Working GroupAnnouncing Rust 1.44.12020-06-18T00:00:00+00:002020-06-18T00:00:00+00:00https://blog.rust-lang.org/2020/06/18/Rust.1.44.1.html<p>The Rust team has published a new point release of Rust, 1.44.1.
Rust is a programming language that is empowering everyone to build reliable and efficient software.</p>
<p>If you have a previous version of Rust installed via rustup, getting Rust 1.44.1 is as easy as:</p>
<pre><code class="language-console">rustup update stable
</code></pre>
<p>If you don't have it already, you can <a href="https://www.rust-lang.org/install.html">get <code>rustup</code></a> from the
appropriate page on our website.</p>
<h2><a href="#whats-in-rust-1441" aria-hidden="true" class="anchor" id="whats-in-rust-1441"></a>What's in Rust 1.44.1</h2>
<p>Rust 1.44.1 addresses several tool regressions in Cargo, Clippy, and Rustfmt introduced in the 1.44.0 stable
release. You can find more detailed information on the specific regressions in the <a href="https://github.com/rust-lang/rust/blob/stable/RELEASES.md#version-1441-2020-06-18">release notes</a>.</p>
<h2><a href="#contributors-to-1441" aria-hidden="true" class="anchor" id="contributors-to-1441"></a>Contributors to 1.44.1</h2>
<p>Many people came together to create Rust 1.44.1.
We couldn't have done it without all of you. <a href="https://thanks.rust-lang.org/rust/1.44.1/">Thanks!</a></p>
The Rust Release Team2020 Event Lineup - Update2020-06-10T00:00:00+00:002020-06-10T00:00:00+00:00https://blog.rust-lang.org/2020/06/10/event-lineup-update.html<p>In 2020 the way we can do events suddenly changed.
In the past we had in-person events all around the world, with some major conferences throughout the year.
With everything changed due to a global pandemic this won't be possible anymore.
Nonetheless the Rust community found ways to continue with events in some form or another.
With more and more events moving online they are getting more accessible to people no matter where they are.</p>
<p>Below you find updated information about Rust events in 2020.</p>
<p>Do you plan to run a Rust online event?
Send an email to the <a href="mailto:community@rust-lang.org">Rust Community team</a> and the team will be able to get your event on the calendar and might be able to offer further help.</p>
<hr />
<h2><a href="#rust-latam" aria-hidden="true" class="anchor" id="rust-latam"></a><strong>Rust LATAM</strong></h2>
<p>Unfortunately the Latin American event <a href="https://rustlatam.org/">Rust LATAM</a> had to be canceled this year.
The team hopes to be able to resume the event in the future.</p>
<hr />
<h2><a href="#oxidizejuly-17th-20th-2020" aria-hidden="true" class="anchor" id="oxidizejuly-17th-20th-2020"></a><strong>Oxidize</strong><br>July 17th-20th, 2020</h2>
<p>The <a href="https://oxidizeconf.com/">Oxidize conference</a> was relabeled to become Oxidize Global.
From July 17-20 you will be able to learn about embedded systems and IoT in Rust.
Over the course of 4 days you will be able to attend online workshops (July 17th), listen to talks (July 18th) and take part in the Impl Days, where you can collaborate with other Embedded Rust contributors in active programming sessions.</p>
<p><a href="https://oxidizeconf.com/#Schedule">Tickets are on sale</a> and the speakers & talks will be announced soon.</p>
<hr />
<h2><a href="#rustconfaugust-20th-2020" aria-hidden="true" class="anchor" id="rustconfaugust-20th-2020"></a><strong>RustConf</strong><br>August 20th, 2020</h2>
<p>The official <a href="https://rustconf.com/">RustConf</a> will be taking place fully online.
Listen to talks and meet other Rust enthusiasts online in digital meetups & breakout rooms.
See the <a href="https://rustconf.com/speakers">list of speakers</a>, register already and follow <a href="https://twitter.com/rustconf">Twitter</a> for updates as the event date approaches!</p>
<hr />
<h2><a href="#rusty-daysjuly-27th---august-2nd-2020" aria-hidden="true" class="anchor" id="rusty-daysjuly-27th---august-2nd-2020"></a><strong>Rusty Days</strong><br>July 27th - August 2nd, 2020</h2>
<p><a href="https://rusty-days.org/">Rusty Days</a> is a new conference and was planned to happen in Wroclaw, Poland.
It now turned into a virtual Rust conference stretched over five days.
You'll be able to see five speakers with five talks -- and everything is free of charge, streamed online and available to watch later.</p>
<p>The <a href="https://rusty-days.org/cfp">Call for Papers</a> is open. Follow <a href="https://twitter.com/rdconf">Twitter</a> for updates.</p>
<hr />
<h2><a href="#rustlaboctober-16th-17th-2020" aria-hidden="true" class="anchor" id="rustlaboctober-16th-17th-2020"></a><strong>RustLab</strong><br>October 16th-17th, 2020</h2>
<p><a href="https://www.rustlab.it">RustLab 2020</a> is also turning into an online event.
The details are not yet settled, but they are aiming for the original dates.
Keep an eye on <a href="https://twitter.com/rustlab_conf">their Twitter stream</a> for further details.</p>
<hr />
<h2><a href="#rustfest-netherlands-globalnovember-7th-8th-2020" aria-hidden="true" class="anchor" id="rustfest-netherlands-globalnovember-7th-8th-2020"></a><strong>RustFest <del>Netherlands</del> Global</strong><br>November 7th-8th, 2020</h2>
<p><a href="https://netherlands.rustfest.eu/">RustFest Netherlands</a> was supposed to happen this June.
The team decided to postpone the event and is now happening as an online conference in Q4 of this year.
More information will be available soon on the <a href="https://blog.rustfest.eu/">RustFest blog</a> and also on <a href="https://twitter.com/rustfest">Twitter</a>.</p>
<p><strong>Update 2020-06-18</strong>: RustFest has announced its dates: November 7th & 8th, running as an online community conference.
See <a href="https://blog.rustfest.eu/announcing-rustfest-2020">the announcement blog post for details</a>.</p>
<hr />
<p>Conferences are not the only thing happening.
More and more local meetups get turned into online events.
We try to highlight these in the <a href="https://calendar.google.com/calendar/embed?src=apd9vmbc22egenmtu5l6c5jbfc@group.calendar.google.com">community calendar</a> as well as in the <a href="https://this-week-in-rust.org/">This Week in Rust newsletter</a>.
Some Rust developers are streaming their work on the language & their Rust projects.
You can get more information in a <a href="https://github.com/jamesmunns/awesome-rust-streaming">curated list of Rust streams</a>.</p>
<p>Do you plan to run a Rust online event?
Send an email to the <a href="mailto:community@rust-lang.org">Rust Community team</a> and the team will be able to get your event on the calendar and might be able to offer further help.</p>
The Rust Community TeamAnnouncing Rust 1.44.02020-06-04T00:00:00+00:002020-06-04T00:00:00+00:00https://blog.rust-lang.org/2020/06/04/Rust-1.44.0.html<p>The Rust team has published a new version of Rust, 1.44.0. Rust is a programming language that is empowering everyone to build reliable and efficient software.</p>
<p>This is a shorter blog post than usual: in acknowledgement that taking a stand against the police brutality currently happening in the US and the world at large is more important than sharing tech knowledge, we decided to significantly scale back the amount of promotion we're doing for this release.</p>
<p>The Rust Core Team believes that tech is and always will be political, and we encourage everyone take the time today to learn about racial inequality and <a href="https://blacklivesmatters.carrd.co/">support the Black Lives Matter movement.</a></p>
<h2><a href="#whats-in-1440-stable" aria-hidden="true" class="anchor" id="whats-in-1440-stable"></a>What's in 1.44.0 stable</h2>
<p>Rust 1.44 is a small release, with <a href="https://github.com/rust-lang/cargo/pull/8062/"><code>cargo tree</code> integrated in Cargo itself</a> and <a href="https://github.com/rust-lang/rust/pull/69033/">support for <code>async</code>/<code>await</code> in <code>no_std</code> contexts</a> as its highlights. You can learn more about all the changes in this release by <a href="https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1440-2020-06-04">reading the release notes</a>.</p>
<h2><a href="#contributors-to-1440" aria-hidden="true" class="anchor" id="contributors-to-1440"></a>Contributors to 1.44.0</h2>
<p>Many people came together to create Rust 1.44.0. We couldn't have done it without all of you. <a href="https://thanks.rust-lang.org/rust/1.44.0/">Thanks!</a></p>
The Rust Core TeamFive Years of Rust2020-05-15T00:00:00+00:002020-05-15T00:00:00+00:00https://blog.rust-lang.org/2020/05/15/five-years-of-rust.html<p>With all that's going on in the world you'd be forgiven for forgetting that as
of today, it has been five years since we released 1.0! Rust has changed
a lot these past five years, so we wanted to reflect back on all of our
contributors' work since the stabilization of the language.</p>
<p>Rust is a general purpose programming language empowering everyone to build
reliable and efficient software. Rust can be built to run anywhere in the stack,
whether as the kernel for your operating system or your next web app. It is built
entirely by an open and diverse community of individuals, primarily volunteers who
generously donate their time and expertise to help make Rust what it is.</p>
<h2><a href="#major-changes-since-10" aria-hidden="true" class="anchor" id="major-changes-since-10"></a>Major Changes since 1.0</h2>
<h4><a href="#2015" aria-hidden="true" class="anchor" id="2015"></a>2015</h4>
<p><strong><a href="https://blog.rust-lang.org/2015/08/06/Rust-1.2.html">1.2</a> — Parallel Codegen:</strong> Compile time improvements are a large theme to every
release of Rust, and it's hard to imagine that there was a short time where
Rust had no parallel code generation at all.</p>
<p><strong><a href="https://blog.rust-lang.org/2015/09/17/Rust-1.3.html">1.3</a> — The Rustonomicon:</strong> Our first release of the fantastic "Rustonomicon", a
book that explores Unsafe Rust and its surrounding topics and has become a great
resource for anyone looking to learn and understand one of the hardest aspects
of the language.</p>
<p><strong><a href="https://blog.rust-lang.org/2015/10/29/Rust-1.4.html">1.4</a> — Windows MSVC Tier 1 Support:</strong> The first tier 1 platform promotion was
bringing native support for 64-bit Windows using the Microsoft Visual C++ toolchain
(MSVC). Before 1.4 you needed to also have MinGW (a third party GNU environment)
installed in order to use and compile your Rust programs. Rust's Windows support
is one of the biggest improvements these past five years. Just recently
Microsoft <a href="https://blogs.windows.com/windowsdeveloper/2020/04/30/rust-winrt-public-preview/">announced a public preview of their official Rust support for the
WinRT API!</a> Now it's easier than ever build top quality native and cross
platform apps.</p>
<p><strong><a href="https://blog.rust-lang.org/2015/12/10/Rust-1.5.html">1.5</a> — Cargo Install:</strong> The addition of being able to build Rust binaries
alongside cargo's pre-existing plugin support has given birth to an entire
ecosystem of apps, utilities, and developer tools that the community has come
to love and depend on. Quite a few of the commands cargo has today were first
plugins that the community built and shared on crates.io!</p>
<h4><a href="#2016" aria-hidden="true" class="anchor" id="2016"></a>2016</h4>
<p><strong><a href="https://blog.rust-lang.org/2016/01/21/Rust-1.6.html">1.6</a> — Libcore:</strong> <code>libcore</code> is a subset of the standard library that only
contains APIs that don't require allocation or operating system level features.
The stabilization of libcore brought the ability to compile Rust with no allocation
or operating system dependency was one of the first major steps towards Rust's
support for embedded systems development.</p>
<p><strong><a href="https://blog.rust-lang.org/2016/07/07/Rust-1.10.html">1.10</a> — C ABI Dynamic Libraries:</strong> The <code>cdylib</code> crate type allows Rust to be
compiled as a C dynamic library, enabling you to embed your Rust projects in
any system that supports the C ABI. Some of Rust's biggest success stories
among users is being able to write a small critical part of their system in
Rust and seamlessly integrate in the larger codebase, and it's now easier
than ever.</p>
<p><strong><a href="https://blog.rust-lang.org/2016/09/29/Rust-1.12.html">1.12</a> — Cargo Workspaces:</strong> Workspaces allow you to organise multiple rust
projects and share the same lockfile. Workspaces have been invaluable in
building large multi-crate level projects.</p>
<p><strong><a href="https://blog.rust-lang.org/2016/11/10/Rust-1.13.html">1.13</a> — The Try Operator:</strong> The first major syntax addition was the <code>?</code> or
the "Try" operator. The operator allows you to easily propagate your error
through your call stack. Previously you had to use the <code>try!</code> macro, which
required you to wrap the entire expression each time you encountered a result,
now you can easily chain methods with <code>?</code> instead.</p>
<pre><code class="language-rust">try!(try!(expression).method()); // Old
expression?.method()?; // New
</code></pre>
<p><strong><a href="https://blog.rust-lang.org/2016/12/22/Rust-1.14.html">1.14</a> — Rustup 1.0:</strong> Rustup is Rust's Toolchain manager, it allows you to
seamlessly use any version of Rust or any of its tooling. What started as a
humble shell script has become what the maintainers affectionately call a
<em>"chimera"</em>. Being able to provide first class compiler version management across
Linux, macOS, Windows, and the dozens of target platforms would have been a
myth just five years ago.</p>
<h4><a href="#2017" aria-hidden="true" class="anchor" id="2017"></a>2017</h4>
<p><strong><a href="https://blog.rust-lang.org/2017/02/02/Rust-1.15.html">1.15</a> — Derive Procedural Macros:</strong> Derive Macros allow you to create powerful
and extensive strongly typed APIs without all the boilerplate. This was the
first version of Rust you could use libraries like <code>serde</code> or <code>diesel</code>'s
derive macros on stable.</p>
<p><strong><a href="https://blog.rust-lang.org/2017/04/27/Rust-1.17.html">1.17</a> — Rustbuild:</strong> One of the biggest improvements for our contributors to
the language was moving our build system from the initial <code>make</code> based system
to using cargo. This has opened up <code>rust-lang/rust</code> to being a lot easier for
members and newcomers alike to build and contribute to the project.</p>
<p><strong><a href="https://blog.rust-lang.org/2017/08/31/Rust-1.20.html">1.20</a> — Associated Constants:</strong> Previously constants could only be associated
with a module. In 1.20 we stabilised associating constants on struct, enums,
and importantly traits. Making it easier to add rich sets of preset values for
types in your API, such as common IP addresses or interesting numbers.</p>
<h4><a href="#2018" aria-hidden="true" class="anchor" id="2018"></a>2018</h4>
<p><strong><a href="https://blog.rust-lang.org/2018/02/15/Rust-1.24.html">1.24</a> — Incremental Compilation:</strong> Before 1.24 when you made a change in your
library rustc would have to re-compile all of the code. Now rustc is a lot
smarter about caching as much as possible and only needing to re-generate
what's needed.</p>
<p><strong><a href="https://blog.rust-lang.org/2018/05/10/Rust-1.26.html">1.26</a> — impl Trait:</strong> The addition of <code>impl Trait</code> gives you expressive
dynamic APIs with the benefits and performance of static dispatch.</p>
<p><strong><a href="https://blog.rust-lang.org/2018/08/02/Rust-1.28.html">1.28</a> — Global Allocators:</strong> Previously you were restricted to using the
allocator that rust provided. With the global allocator API you can now
customise your allocator to one that suits your needs. This was an important
step in enabling the creation of the <code>alloc</code> library, another subset of the
standard library containing only the parts of std that need an allocator like
<code>Vec</code> or <code>String</code>. Now it's easier than ever to use even more parts of the
standard library on a variety of systems.</p>
<p><strong><a href="https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html">1.31</a> — 2018 edition:</strong> The release of the 2018 edition was easily our biggest
release since 1.0, adding a collection of syntax changes and improvements to
writing Rust written in a completely backwards compatible fashion, allowing
libraries built with different editions to seamlessly work together.</p>
<ul>
<li><strong>Non-Lexical Lifetimes</strong> A huge improvement to Rust's borrow checker,
allowing it to accept more verifiable safe code.</li>
<li><strong>Module System Improvements</strong> Large UX improvements to how we define and
use modules.</li>
<li><strong>Const Functions</strong> Const functions allow you to run and evaluate Rust code
at compile time.</li>
<li><strong>Rustfmt 1.0</strong> A new code formatting tool built specifically for Rust.</li>
<li><strong>Clippy 1.0</strong> Rust's linter for catching common mistakes. Clippy makes it a lot
easier to make sure that your code is not only safe but correct.</li>
<li><strong>Rustfix</strong> With all the syntax changes, we knew we wanted to provide the
tooling to make the transition as easy as possible. Now when changes are
required to Rust's syntax they're just a <code>cargo fix</code> away from being resolved.</li>
</ul>
<h4><a href="#2019" aria-hidden="true" class="anchor" id="2019"></a>2019</h4>
<p><strong><a href="https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html">1.34</a> — Alternative Crate Registries:</strong> As Rust is used more and more in
production, there is a greater need to be able to host and use your projects
in non-public spaces, while cargo has always allowed remote git dependencies,
with Alternative Registries your organisation can easily build and share your
own registry of crates that can be used in your projects like they were
on crates.io.</p>
<p><strong><a href="https://blog.rust-lang.org/2019/11/07/Rust-1.39.0.html">1.39</a> — Async/Await:</strong> The stabilisation of the async/await keywords for
handling Futures was one of the major milestones to making async programming
in Rust a first class citizen. Even just six months after its release
async programming in Rust has blossomed into a diverse and performant ecosystem.</p>
<h4><a href="#2020" aria-hidden="true" class="anchor" id="2020"></a>2020</h4>
<p><strong><a href="https://blog.rust-lang.org/2020/03/12/Rust-1.42.html">1.42</a> — Subslice patterns:</strong> While not the biggest change, the addition
of the <code>..</code> (rest) pattern has been a long awaited quality of life
feature that greatly improves the expressivity of pattern matching
with slices.</p>
<h2><a href="#error-diagnostics" aria-hidden="true" class="anchor" id="error-diagnostics"></a>Error Diagnostics</h2>
<p>One thing that we haven't mentioned much is how much Rust's error messages and
diagnostics have improved since 1.0. Looking at older error messages now feels
like looking at a different language.</p>
<p>We’ve highlighted a couple of examples that best showcase just how much we’ve
improved showing users where they made mistakes and importantly help them
understand why it doesn’t work and teach them how they can fix it.</p>
<h5><a href="#first-example-traits" aria-hidden="true" class="anchor" id="first-example-traits"></a>First Example (Traits)</h5>
<pre><code class="language-rust">use std::io::Write;
fn trait_obj(w: &Write) {
generic(w);
}
fn generic<W: Write>(_w: &W) {}
</code></pre>
<details>
<summary>1.2.0 Error Message</summary>
<pre><code> Compiling error-messages v0.1.0 (file:///Users/usr/src/rust/error-messages)
src/lib.rs:6:5: 6:12 error: the trait `core::marker::Sized` is not implemented for the type `std::io::Write` [E0277]
src/lib.rs:6 generic(w);
^~~~~~~
src/lib.rs:6:5: 6:12 note: `std::io::Write` does not have a constant size known at compile-time
src/lib.rs:6 generic(w);
^~~~~~~
error: aborting due to previous error
Could not compile `error-messages`.
To learn more, run the command again with --verbose.
</code></pre>
</details>
<p><img src="/images/2020-05-15-five-years-of-rust/trait-error-1.2.0.png" alt="A terminal screenshot of the 1.2.0 error message." /></p>
<details>
<summary>1.43.0 Error Message</summary>
<pre><code> Compiling error-messages v0.1.0 (/Users/ep/src/rust/error-messages)
error[E0277]: the size for values of type `dyn std::io::Write` cannot be known at compilation time
--> src/lib.rs:6:13
|
6 | generic(w);
| ^ doesn't have a size known at compile-time
...
9 | fn generic<W: Write>(_w: &W) {}
| ------- - - help: consider relaxing the implicit `Sized` restriction: `+ ?Sized`
| |
| required by this bound in `generic`
|
= help: the trait `std::marker::Sized` is not implemented for `dyn std::io::Write`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
error: could not compile `error-messages`.
To learn more, run the command again with --verbose.
</code></pre>
</details>
<p><img src="/images/2020-05-15-five-years-of-rust/trait-error-1.43.0.png" alt="A terminal screenshot of the 1.43.0 error message." /></p>
<h5><a href="#second-example-help" aria-hidden="true" class="anchor" id="second-example-help"></a>Second Example (help)</h5>
<pre><code class="language-rust">fn main() {
let s = "".to_owned();
println!("{:?}", s.find("".to_owned()));
}
</code></pre>
<details>
<summary>1.2.0 Error Message</summary>
<pre><code> Compiling error-messages v0.1.0 (file:///Users/ep/src/rust/error-messages)
src/lib.rs:3:24: 3:43 error: the trait `core::ops::FnMut<(char,)>` is not implemented for the type `collections::string::String` [E0277]
src/lib.rs:3 println!("{:?}", s.find("".to_owned()));
^~~~~~~~~~~~~~~~~~~
note: in expansion of format_args!
<std macros>:2:25: 2:56 note: expansion site
<std macros>:1:1: 2:62 note: in expansion of print!
<std macros>:3:1: 3:54 note: expansion site
<std macros>:1:1: 3:58 note: in expansion of println!
src/lib.rs:3:5: 3:45 note: expansion site
src/lib.rs:3:24: 3:43 error: the trait `core::ops::FnOnce<(char,)>` is not implemented for the type `collections::string::String` [E0277]
src/lib.rs:3 println!("{:?}", s.find("".to_owned()));
^~~~~~~~~~~~~~~~~~~
note: in expansion of format_args!
<std macros>:2:25: 2:56 note: expansion site
<std macros>:1:1: 2:62 note: in expansion of print!
<std macros>:3:1: 3:54 note: expansion site
<std macros>:1:1: 3:58 note: in expansion of println!
src/lib.rs:3:5: 3:45 note: expansion site
error: aborting due to 2 previous errors
Could not compile `error-messages`.
To learn more, run the command again with --verbose.
</code></pre>
</details>
<p><img src="/images/2020-05-15-five-years-of-rust/help-error-1.2.0.png" alt="A terminal screenshot of the 1.2.0 error message." /></p>
<details>
<summary>1.43.0 Error Message</summary>
<pre><code> Compiling error-messages v0.1.0 (/Users/ep/src/rust/error-messages)
error[E0277]: expected a `std::ops::FnMut<(char,)>` closure, found `std::string::String`
--> src/lib.rs:3:29
|
3 | println!("{:?}", s.find("".to_owned()));
| ^^^^^^^^^^^^^
| |
| expected an implementor of trait `std::str::pattern::Pattern<'_>`
| help: consider borrowing here: `&"".to_owned()`
|
= note: the trait bound `std::string::String: std::str::pattern::Pattern<'_>` is not satisfied
= note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `std::string::String`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
error: could not compile `error-messages`.
To learn more, run the command again with --verbose.
</code></pre>
</details>
<p><img src="/images/2020-05-15-five-years-of-rust/help-error-1.43.0.png" alt="A terminal screenshot of the 1.43.0 error message." /></p>
<h5><a href="#third-example-borrow-checker" aria-hidden="true" class="anchor" id="third-example-borrow-checker"></a>Third Example (Borrow checker)</h5>
<pre><code class="language-rust">fn main() {
let mut x = 7;
let y = &mut x;
println!("{} {}", x, y);
}
</code></pre>
<details>
<summary>1.2.0 Error Message</summary>
<pre><code> Compiling error-messages v0.1.0 (file:///Users/ep/src/rust/error-messages)
src/lib.rs:5:23: 5:24 error: cannot borrow `x` as immutable because it is also borrowed as mutable
src/lib.rs:5 println!("{} {}", x, y);
^
note: in expansion of format_args!
<std macros>:2:25: 2:56 note: expansion site
<std macros>:1:1: 2:62 note: in expansion of print!
<std macros>:3:1: 3:54 note: expansion site
<std macros>:1:1: 3:58 note: in expansion of println!
src/lib.rs:5:5: 5:29 note: expansion site
src/lib.rs:3:18: 3:19 note: previous borrow of `x` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `x` until the borrow ends
src/lib.rs:3 let y = &mut x;
^
src/lib.rs:6:2: 6:2 note: previous borrow ends here
src/lib.rs:1 fn main() {
src/lib.rs:2 let mut x = 7;
src/lib.rs:3 let y = &mut x;
src/lib.rs:4
src/lib.rs:5 println!("{} {}", x, y);
src/lib.rs:6 }
^
error: aborting due to previous error
Could not compile `error-messages`.
To learn more, run the command again with --verbose.
</code></pre>
</details>
<p><img src="/images/2020-05-15-five-years-of-rust/borrow-error-1.2.0.png" alt="A terminal screenshot of the 1.2.0 error message." /></p>
<details>
<summary>1.43.0 Error Message</summary>
<pre><code> Compiling error-messages v0.1.0 (/Users/ep/src/rust/error-messages)
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
--> src/lib.rs:5:23
|
3 | let y = &mut x;
| ------ mutable borrow occurs here
4 |
5 | println!("{} {}", x, y);
| ^ - mutable borrow later used here
| |
| immutable borrow occurs here
error: aborting due to previous error
For more information about this error, try `rustc --explain E0502`.
error: could not compile `error-messages`.
To learn more, run the command again with --verbose.
</code></pre>
</details>
<p><img src="/images/2020-05-15-five-years-of-rust/borrow-error-1.43.0.png" alt="A terminal screenshot of the 1.43.0 error message." /></p>
<h2><a href="#quotes-from-the-teams" aria-hidden="true" class="anchor" id="quotes-from-the-teams"></a>Quotes from the teams</h2>
<p>Of course we can't cover every change that has happened. So we reached out and
asked some of our teams what changes they are most proud of:</p>
<blockquote>
<p>For rustdoc, the big things were:</p>
<ul>
<li>The automatically generated documentation for blanket implementations</li>
<li>The search itself and its optimizations (last one being to convert it into JSON)</li>
<li>The possibility to test more accurately doc code blocks "compile_fail,
should_panic, allow_fail"</li>
<li>Doc tests are now generated as their own seperate binaries.</li>
</ul>
<p>— Guillaume Gomez (<a href="https://www.rust-lang.org/governance/teams/dev-tools#rustdoc">rustdoc</a>)</p>
</blockquote>
<blockquote>
<p>Rust now has baseline IDE support! Between IntelliJ Rust, RLS and
rust-analyzer, I feel that most users should be able to find "not horrible"
experience for their editor of choice. Five years ago, "writing Rust" meant
using old school Vim/Emacs setup.</p>
<p>— Aleksey Kladov (<a href="https://www.rust-lang.org/governance/teams/dev-tools#ides">IDEs and editors</a>)</p>
</blockquote>
<blockquote>
<p>For me that would be: Adding first class support for popular embedded
architectures and achieving a striving ecosystem to make micro controller
development with Rust an easy and safe, yet fun experience.</p>
<p>— Daniel Egger (<a href="https://www.rust-lang.org/governance/wgs/embedded">Embedded WG</a>)</p>
</blockquote>
<blockquote>
<p>The release team has only been around since (roughly) early 2018, but even in
that time, we've landed ~40000 commits just in rust-lang/rust without any
significant regressions in stable.</p>
<p>Considering how quickly we're improving the compiler and standard libraries, I
think that's really impressive (though of course the release team is not the
sole contributor here). Overall, I've found that the release team has done an
excellent job of managing to scale to the increasing traffic on issue
trackers, PRs being filed, etc.</p>
<p>— Mark Rousskov (<a href="https://www.rust-lang.org/governance/teams/operations#release">Release</a>)</p>
</blockquote>
<blockquote>
<p>Within the last 3 years we managed to turn <a href="https://github.com/rust-lang/miri">Miri</a> from an experimental
interpreter into a practical tool for exploring language design and finding
bugs in real code—a great combination of PL theory and practice. On the
theoretical side we have <a href="https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md">Stacked Borrows</a>, the most concrete proposal for a
Rust aliasing model so far. On the practical side, while initially only a
few key libraries were checked in Miri by us, recently we saw a great uptake
of people using Miri to <a href="https://github.com/rust-lang/miri/#bugs-found-by-miri">find and fix bugs</a> in their own crates and
dependencies, and a similar uptake in contributors improving Miri e.g. by
adding support for file system access, unwinding, and concurrency.</p>
<p>— Ralf Jung (<a href="https://www.rust-lang.org/governance/teams/compiler#miri">Miri</a>)</p>
</blockquote>
<blockquote>
<p>If I had to pick one thing I'm most proud of, it was the work on non-lexical
lifetimes (NLL). It's not only because I think it made a big difference in
the usability of Rust, but also because of the way that we implemented it by
forming the NLL working group. This working group brought in a lot of great
contributors, many of whom are still working on the compiler today. Open
source at its best!</p>
<p>— Niko Matsakis (<a href="https://www.rust-lang.org/governance/teams/lang">Language</a>)</p>
</blockquote>
<h2><a href="#the-community" aria-hidden="true" class="anchor" id="the-community"></a>The Community</h2>
<p>As the language has changed and grown a lot in these past five years so has its
community. There's been so many great projects written in Rust, and Rust's
presence in production has grown exponentially. We wanted to share some
statistics on just how much Rust has grown.</p>
<ul>
<li>Rust has been voted <a href="https://insights.stackoverflow.com/survey/2019#most-loved-dreaded-and-wanted">"Most Loved Programming Language"</a> every year in the past
four Stack Overflow developer surveys since it went 1.0.</li>
<li>We have served over 2.25 Petabytes (1PB = 1,000 TB) of different versions of the
compiler, tooling, and documentation this year alone!</li>
<li>In the same time we have served over 170TB of crates to roughly 1.8 billion
requests on crates.io, doubling the monthly traffic compared to last year.</li>
</ul>
<p>When Rust turned 1.0 you could count the number of companies that were
using it in production on one hand. Today, it is being used by hundreds of
tech companies with some of the largest tech companies such as Apple, Amazon,
Dropbox, Facebook, Google, and Microsoft choosing to use Rust for its performance,
reliability, and productivity in their projects.</p>
<h2><a href="#conclusion" aria-hidden="true" class="anchor" id="conclusion"></a>Conclusion</h2>
<p>Obviously we couldn't cover every change or improvement to Rust that's happened
since 2015. What have been your favourite changes or new favourite Rust
projects? Feel free to post your answer and discussion on <a href="https://users.rust-lang.org/t/five-years-of-rust/42661">our
Discourse forum</a>.</p>
<p>Lastly, we wanted to thank everyone who has to contributed to the Rust, whether
you contributed a new feature or fixed a typo, your work has made Rust the
amazing project it is today. We can't wait to see how Rust and its community will
continue to grow and change, and see what you all will build with Rust in the
coming decade!</p>
The Rust Core Team