-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRust-1.68.0.html
227 lines (212 loc) · 13 KB
/
Rust-1.68.0.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Announcing Rust 1.68.0 | Rust Blog</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="description" content="Empowering everyone to build reliable and efficient software.">
<!-- Twitter card -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@rustlang">
<meta name="twitter:creator" content="@rustlang">
<meta name="twitter:title" content="Announcing Rust 1.68.0 | Rust Blog">
<meta name="twitter:description" content="Empowering everyone to build reliable and efficient software.">
<meta name="twitter:image" content="https://www.rust-lang.org/static/images/rust-social.jpg">
<!-- Facebook OpenGraph -->
<meta property="og:title" content="Announcing Rust 1.68.0 | Rust Blog" />
<meta property="og:description" content="Empowering everyone to build reliable and efficient software.">
<meta property="og:image" content="https://www.rust-lang.org/static/images/rust-social-wide.jpg" />
<meta property="og:type" content="website" />
<meta property="og:locale" content="en_US" />
<!-- styles -->
<link rel="stylesheet" href="../../../styles/vendor.css"/>
<link rel="stylesheet" href="../../../styles/fonts.css"/>
<link rel="stylesheet" href="../../../styles/app.css"/>
<link rel="stylesheet" href="../../../styles/highlight.css"/>
<!-- favicon -->
<link rel="apple-touch-icon" sizes="180x180" href="../../../images/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="16x16" href="../../../images/favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="../../../images/favicon-32x32.png">
<link rel="icon" type="image/svg+xml" href="../../../images/favicon.svg">
<link rel="manifest" href="../../../images/site.webmanifest">
<link rel="mask-icon" href="../../../images/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#00aba9">
<meta name="theme-color" content="#ffffff">
<!-- atom -->
<link type="application/atom+xml" rel="alternate" href="https://blog.rust-lang.org/feed.xml" title="Rust Blog" />
</head>
<body>
<nav class="flex flex-row justify-center justify-end-l items-center flex-wrap ph2 pl3-ns pr4-ns">
<div class="brand flex-auto w-100 w-auto-l self-start tc tl-l">
<a href="../../../">
<img class="v-mid ml0-l" alt="Rust Logo" src="../../../images/rust-logo-blk.svg">
<span class="dib ml1 ml0-l">Rust Blog</span>
</a>
</div>
<ul class="nav list w-100 w-auto-l flex flex-none flex-row flex-wrap justify-center justify-end-l items-center pv2 ph0 ph4-ns">
<li class="tc pv2 ph2 ph4-ns flex-20-s"><a href="https://www.rust-lang.org">Rust</a></li>
<li class="tc pv2 ph2 ph4-ns flex-20-s"><a href="https://www.rust-lang.org/tools/install">Install</a></li>
<li class="tc pv2 ph2 ph4-ns flex-20-s"><a href="https://www.rust-lang.org/learn">Learn</a></li>
<li class="tc pv2 ph2 ph4-ns flex-20-s"><a href="https://www.rust-lang.org/tools">Tools</a></li>
<li class="tc pv2 ph2 ph4-ns flex-20-s"><a href="https://www.rust-lang.org/governance">Governance</a></li>
<li class="tc pv2 ph2 ph4-ns flex-20-s"><a href="https://www.rust-lang.org/community">Community</a></li>
</ul>
</nav>
<section id="Announcing Rust 1.68.0" class="white">
<div class="w-100 mw-none ph3 mw8-m mw8-l center f3">
<header>
<h2>Announcing Rust 1.68.0</h2>
<div class="highlight mt2 mb3"></div>
</header>
<div class="publish-date-author">Mar. 9, 2023 · The Rust Release Team
</div>
<div class="post">
<p>The Rust team is happy to announce a new version of Rust, 1.68.0. Rust is a
programming language empowering everyone to build reliable and efficient
software.</p>
<p>If you have a previous version of Rust installed via rustup, you can get 1.68.0
with:</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-1680-2023-03-09">detailed release notes for
1.68.0</a>
on GitHub.</p>
<p>If you'd like to help us out by testing future releases, you might consider
updating locally to use the beta channel (<code>rustup default beta</code>) or the nightly
channel (<code>rustup default nightly</code>). Please
<a href="https://github.com/rust-lang/rust/issues/new/choose">report</a> any bugs you
might come across!</p>
<h2><a href="#whats-in-1680-stable" aria-hidden="true" class="anchor" id="whats-in-1680-stable"></a>What's in 1.68.0 stable</h2>
<h3><a href="#cargos-sparse-protocol" aria-hidden="true" class="anchor" id="cargos-sparse-protocol"></a>Cargo's sparse protocol</h3>
<p>Cargo's "sparse" registry protocol has been stabilized for reading the index of
crates, along with infrastructure at <code>https://index.crates.io/</code> for those
published in the primary crates.io registry. The prior git protocol (which is
still the default) clones a repository that indexes <em>all</em> crates available in
the registry, but this has started to hit scaling limitations, with noticeable
delays while updating that repository. The new protocol should provide a
significant performance improvement when accessing crates.io, as it will only
download information about the subset of crates that you actually use.</p>
<p>To use the sparse protocol with crates.io, set the environment variable
<code>CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse</code>, or edit your
<a href="https://doc.rust-lang.org/cargo/reference/config.html"><code>.cargo/config.toml</code> file</a>
to add:</p>
<pre><code class="language-toml">[registries.crates-io]
protocol = "sparse"
</code></pre>
<p>The sparse protocol is currently planned to become the default for crates.io in
the 1.70.0 release in a few months. For more information, please see the prior
<a href="https://blog.rust-lang.org/inside-rust/2023/01/30/cargo-sparse-protocol.html">announcement</a>
on the Inside Rust Blog, as well as
<a href="https://rust-lang.github.io/rfcs/2789-sparse-index.html">RFC 2789</a>
and the current
<a href="https://doc.rust-lang.org/stable/cargo/reference/registry-index.html#sparse-protocol">documentation</a>
in the Cargo Book.</p>
<h3><a href="#local-pin-construction" aria-hidden="true" class="anchor" id="local-pin-construction"></a>Local <code>Pin</code> construction</h3>
<p>The new <a href="https://doc.rust-lang.org/stable/std/pin/macro.pin.html"><code>pin!</code></a> macro
constructs a <code>Pin<&mut T></code> from a <code>T</code> expression, anonymously captured in local
state. This is often called stack-pinning, but that "stack" could also be the
captured state of an <code>async fn</code> or block. This macro is similar to some crates,
like <a href="https://docs.rs/tokio/1/tokio/macro.pin.html"><code>tokio::pin!</code></a>, but the
standard library can take advantage of <code>Pin</code> internals and <a href="https://doc.rust-lang.org/stable/reference/destructors.html#temporary-lifetime-extension">temporary lifetime
extension</a>
for a more expression-like macro.</p>
<pre><code class="language-rust">/// Runs a future to completion.
fn block_on<F: Future>(future: F) -> F::Output {
let waker_that_unparks_thread = todo!();
let mut cx = Context::from_waker(&waker_that_unparks_thread);
// Pin the future so it can be polled.
let mut pinned_future = pin!(future);
loop {
match pinned_future.as_mut().poll(&mut cx) {
Poll::Pending => thread::park(),
Poll::Ready(result) => return result,
}
}
}
</code></pre>
<p>In this example, the original <code>future</code> will be moved into a temporary local,
referenced by the new <code>pinned_future</code> with type <code>Pin<&mut F></code>, and that pin is
subject to the normal borrow checker to make sure it can't outlive that local.</p>
<h3><a href="#default-alloc-error-handler" aria-hidden="true" class="anchor" id="default-alloc-error-handler"></a>Default <code>alloc</code> error handler</h3>
<p>When allocation fails in Rust, APIs like <code>Box::new</code> and <code>Vec::push</code> have no way
to indicate that failure, so some divergent execution path needs to be taken.
When using the <code>std</code> crate, the program will print to <code>stderr</code> and abort.
As of Rust 1.68.0, binaries which include <code>std</code> will continue to have
this behavior. Binaries which do not include <code>std</code>, only including <code>alloc</code>, will now <code>panic!</code>
on allocation failure, which may be further adjusted via a <code>#[panic_handler]</code> if desired.</p>
<p>In the future, it's likely that the behavior for <code>std</code> will also be changed to match that of <code>alloc</code>-only binaries.</p>
<h3><a href="#stabilized-apis" aria-hidden="true" class="anchor" id="stabilized-apis"></a>Stabilized APIs</h3>
<ul>
<li><a href="https://doc.rust-lang.org/stable/std/pin/macro.pin.html"><code>{core,std}::pin::pin!</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/std/primitive.f32.html#impl-From%3Cbool%3E-for-f32"><code>impl From<bool> for {f32,f64}</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/std/path/constant.MAIN_SEPARATOR_STR.html"><code>std::path::MAIN_SEPARATOR_STR</code></a></li>
<li><a href="https://doc.rust-lang.org/stable/std/path/struct.PathBuf.html#impl-DerefMut-for-PathBuf"><code>impl DerefMut for PathBuf</code></a></li>
</ul>
<p>These APIs are now stable in const contexts:</p>
<ul>
<li><a href="https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.new"><code>VecDeque::new</code></a></li>
</ul>
<h3><a href="#other-changes" aria-hidden="true" class="anchor" id="other-changes"></a>Other changes</h3>
<ul>
<li>As <a href="https://blog.rust-lang.org/2023/01/09/android-ndk-update-r25.html">previously announced</a>,
Android platform support in Rust is now targeting NDK r25, which corresponds to
a minimum supported API level of 19 (KitKat).</li>
</ul>
<p>Check out everything that changed in
<a href="https://github.com/rust-lang/rust/blob/stable/RELEASES.md#version-1680-2023-03-09">Rust</a>,
<a href="https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-168-2023-03-09">Cargo</a>,
and <a href="https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-168">Clippy</a>.</p>
<h3><a href="#contributors-to-1680" aria-hidden="true" class="anchor" id="contributors-to-1680"></a>Contributors to 1.68.0</h3>
<p>Many people came together to create Rust 1.68.0.
We couldn't have done it without all of you.
<a href="https://thanks.rust-lang.org/rust/1.68.0/">Thanks!</a></p>
</div>
</div>
</section>
<footer>
<div class="w-100 mw-none ph3 mw8-m mw9-l center f3">
<div class="row">
<div class="four columns mt3 mt0-l" id="get-help">
<h4>Get help!</h4>
<ul>
<li><a href="https://doc.rust-lang.org" target="_blank" rel="noopener">Documentation</a></li>
<li><a href="mailto:[email protected]">Contact the Rust Team</a></li>
</ul>
</div>
<div class="four columns mt3 mt0-l">
<h4>Terms and policies</h4>
<ul>
<li><a href="https://www.rust-lang.org/policies/code-of-conduct">Code of Conduct</a></li>
<li><a href="https://www.rust-lang.org/policies/licenses">Licenses</a></li>
<li><a href="https://www.rust-lang.org/policies/media-guide">Logo Policy and Media Guide</a></li>
<li><a href="https://www.rust-lang.org/policies/security">Security Disclosures</a></li>
<li><a href="https://www.rust-lang.org/policies">All Policies</a></li>
</ul>
</div>
<div class="four columns mt3 mt0-l">
<h4>Social</h4>
<div class="flex flex-row flex-wrap">
<a href="https://twitter.com/rustlang" target="_blank" rel="noopener" alt="twitter link"><img src="../../../images/twitter.svg" alt="twitter logo" title="Twitter"/></a>
<a href="https://www.youtube.com/channel/UCaYhcUwRBNscFNUKTjgPFiA" target="_blank" rel="noopener" alt="youtube link"><img style="padding-top: 6px; padding-bottom:6px" src="../../../images/youtube.svg" alt="youtube logo" title="YouTube"/></a>
<a href="https://discord.gg/rust-lang" target="_blank" rel="noopener" alt="discord link"><img src="../../../images/discord.svg" alt="discord logo" title="Discord"/></a>
<a href="https://github.com/rust-lang" target="_blank" rel="noopener" alt="github link"><img src="../../../images/github.svg" alt="github logo" title="GitHub"/></a>
</div>
<h4 class="mt4 mb3">RSS</h4>
<ul>
<li><a href="../../../feed.xml">Main Blog</a></li>
<li><a href="../../../inside-rust/feed.xml">"Inside Rust" Blog</a></li>
</ul>
</div>
</div>
<div class="attribution">
Maintained by the Rust Team. See a typo?
<a href="https://github.com/rust-lang/blog.rust-lang.org" target="_blank" rel="noopener">Send a fix here</a>!
</div>
</div>
</footer>
<!-- scripts -->
<script src="../../../scripts/highlight.js"></script>
</body>
</html>