Skip to content

Commit 690501e

Browse files
committed
Auto merge of #81878 - pietroalbini:stable-1.50.0, r=pietroalbini
Rust 1.50.0 stable release This PR builds the artifacts for the 1.50.0 stable release, and: * Cherry-picks e4e460b to fix #81208, as recommended in #81337 (comment). * Backports the release notes of 1.49.0 and 1.50.0. r? `@ghost` cc `@rust-lang/release`
2 parents 2efd070 + 2602fa0 commit 690501e

File tree

6 files changed

+276
-11
lines changed

6 files changed

+276
-11
lines changed

RELEASES.md

+249-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,249 @@
1+
Version 1.50.0 (2021-02-11)
2+
============================
3+
4+
Language
5+
-----------------------
6+
- [You can now use `const` values for `x` in `[x; N]` array expressions.][79270]
7+
This has been technically possible since 1.38.0, as it was unintentionally stabilized.
8+
- [Assignments to `ManuallyDrop<T>` union fields are now considered safe.][78068]
9+
10+
Compiler
11+
-----------------------
12+
- [Added tier 3\* support for the `armv5te-unknown-linux-uclibceabi` target.][78142]
13+
- [Added tier 3 support for the `aarch64-apple-ios-macabi` target.][77484]
14+
- [The `x86_64-unknown-freebsd` is now built with the full toolset.][79484]
15+
16+
\* Refer to Rust's [platform support page][forge-platform-support] for more
17+
information on Rust's tiered platform support.
18+
19+
Libraries
20+
-----------------------
21+
22+
- [`proc_macro::Punct` now implements `PartialEq<char>`.][78636]
23+
- [`ops::{Index, IndexMut}` are now implemented for fixed sized arrays of any length.][74989]
24+
- [On Unix platforms, the `std::fs::File` type now has a "niche" of `-1`.][74699]
25+
This value cannot be a valid file descriptor, and now means `Option<File>` takes
26+
up the same amount of space as `File`.
27+
28+
Stabilized APIs
29+
---------------
30+
31+
- [`bool::then`]
32+
- [`btree_map::Entry::or_insert_with_key`]
33+
- [`f32::clamp`]
34+
- [`f64::clamp`]
35+
- [`hash_map::Entry::or_insert_with_key`]
36+
- [`Ord::clamp`]
37+
- [`RefCell::take`]
38+
- [`slice::fill`]
39+
- [`UnsafeCell::get_mut`]
40+
41+
The following previously stable methods are now `const`.
42+
43+
- [`IpAddr::is_ipv4`]
44+
- [`IpAddr::is_ipv6`]
45+
- [`Layout::size`]
46+
- [`Layout::align`]
47+
- [`Layout::from_size_align`]
48+
- `pow` for all integer types.
49+
- `checked_pow` for all integer types.
50+
- `saturating_pow` for all integer types.
51+
- `wrapping_pow` for all integer types.
52+
- `next_power_of_two` for all unsigned integer types.
53+
- `checked_power_of_two` for all unsigned integer types.
54+
55+
Cargo
56+
-----------------------
57+
58+
- [Added the `[build.rustc-workspace-wrapper]` option.][cargo/8976]
59+
This option sets a wrapper to execute instead of `rustc`, for workspace members only.
60+
- [`cargo:rerun-if-changed` will now, if provided a directory, scan the entire
61+
contents of that directory for changes.][cargo/8973]
62+
- [Added the `--workspace` flag to the `cargo update` command.][cargo/8725]
63+
64+
Misc
65+
----
66+
67+
- [The search results tab and the help button are focusable with keyboard in rustdoc.][79896]
68+
- [Running tests will now print the total time taken to execute.][75752]
69+
70+
Compatibility Notes
71+
-------------------
72+
73+
- [The `compare_and_swap` method on atomics has been deprecated.][79261] It's
74+
recommended to use the `compare_exchange` and `compare_exchange_weak` methods instead.
75+
- [Changes in how `TokenStream`s are checked have fixed some cases where you could write
76+
unhygenic `macro_rules!` macros.][79472]
77+
- [`#![test]` as an inner attribute is now considered unstable like other inner macro
78+
attributes, and reports an error by default through the `soft_unstable` lint.][79003]
79+
- [Overriding a `forbid` lint at the same level that it was set is now a hard error.][78864]
80+
- [Dropped support for all cloudabi targets.][78439]
81+
- [You can no longer intercept `panic!` calls by supplying your own macro.][78343] It's
82+
recommended to use the `#[panic_handler]` attribute to provide your own implementation.
83+
- [Semi-colons after item statements (e.g. `struct Foo {};`) now produce a warning.][78296]
84+
85+
[74989]: https://github.com/rust-lang/rust/pull/74989
86+
[79261]: https://github.com/rust-lang/rust/pull/79261
87+
[79896]: https://github.com/rust-lang/rust/pull/79896
88+
[79484]: https://github.com/rust-lang/rust/pull/79484
89+
[79472]: https://github.com/rust-lang/rust/pull/79472
90+
[79270]: https://github.com/rust-lang/rust/pull/79270
91+
[79003]: https://github.com/rust-lang/rust/pull/79003
92+
[78864]: https://github.com/rust-lang/rust/pull/78864
93+
[78636]: https://github.com/rust-lang/rust/pull/78636
94+
[78439]: https://github.com/rust-lang/rust/pull/78439
95+
[78343]: https://github.com/rust-lang/rust/pull/78343
96+
[78296]: https://github.com/rust-lang/rust/pull/78296
97+
[78068]: https://github.com/rust-lang/rust/pull/78068
98+
[75752]: https://github.com/rust-lang/rust/pull/75752
99+
[74699]: https://github.com/rust-lang/rust/pull/74699
100+
[78142]: https://github.com/rust-lang/rust/pull/78142
101+
[77484]: https://github.com/rust-lang/rust/pull/77484
102+
[cargo/8976]: https://github.com/rust-lang/cargo/pull/8976
103+
[cargo/8973]: https://github.com/rust-lang/cargo/pull/8973
104+
[cargo/8725]: https://github.com/rust-lang/cargo/pull/8725
105+
[`IpAddr::is_ipv4`]: https://doc.rust-lang.org/stable/std/net/enum.IpAddr.html#method.is_ipv4
106+
[`IpAddr::is_ipv6`]: https://doc.rust-lang.org/stable/std/net/enum.IpAddr.html#method.is_ipv6
107+
[`Layout::align`]: https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.align
108+
[`Layout::from_size_align`]: https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.from_size_align
109+
[`Layout::size`]: https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.size
110+
[`Ord::clamp`]: https://doc.rust-lang.org/stable/std/cmp/trait.Ord.html#method.clamp
111+
[`RefCell::take`]: https://doc.rust-lang.org/stable/std/cell/struct.RefCell.html#method.take
112+
[`UnsafeCell::get_mut`]: https://doc.rust-lang.org/stable/std/cell/struct.UnsafeCell.html#method.get_mut
113+
[`bool::then`]: https://doc.rust-lang.org/stable/std/primitive.bool.html#method.then
114+
[`btree_map::Entry::or_insert_with_key`]: https://doc.rust-lang.org/stable/std/collections/btree_map/enum.Entry.html#method.or_insert_with_key
115+
[`f32::clamp`]: https://doc.rust-lang.org/stable/std/primitive.f32.html#method.clamp
116+
[`f64::clamp`]: https://doc.rust-lang.org/stable/std/primitive.f64.html#method.clamp
117+
[`hash_map::Entry::or_insert_with_key`]: https://doc.rust-lang.org/stable/std/collections/hash_map/enum.Entry.html#method.or_insert_with_key
118+
[`slice::fill`]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.fill
119+
120+
121+
Version 1.49.0 (2020-12-31)
122+
============================
123+
124+
Language
125+
-----------------------
126+
127+
- [Unions can now implement `Drop`, and you can now have a field in a union
128+
with `ManuallyDrop<T>`.][77547]
129+
- [You can now cast uninhabited enums to integers.][76199]
130+
- [You can now bind by reference and by move in patterns.][76119] This
131+
allows you to selectively borrow individual components of a type. E.g.
132+
```rust
133+
#[derive(Debug)]
134+
struct Person {
135+
name: String,
136+
age: u8,
137+
}
138+
139+
let person = Person {
140+
name: String::from("Alice"),
141+
age: 20,
142+
};
143+
144+
// `name` is moved out of person, but `age` is referenced.
145+
let Person { name, ref age } = person;
146+
println!("{} {}", name, age);
147+
```
148+
149+
Compiler
150+
-----------------------
151+
152+
- [Added tier 1\* support for `aarch64-unknown-linux-gnu`.][78228]
153+
- [Added tier 2 support for `aarch64-apple-darwin`.][75991]
154+
- [Added tier 2 support for `aarch64-pc-windows-msvc`.][75914]
155+
- [Added tier 3 support for `mipsel-unknown-none`.][78676]
156+
- [Raised the minimum supported LLVM version to LLVM 9.][78848]
157+
- [Output from threads spawned in tests is now captured.][78227]
158+
- [Change os and vendor values to "none" and "unknown" for some targets][78951]
159+
160+
\* Refer to Rust's [platform support page][forge-platform-support] for more
161+
information on Rust's tiered platform support.
162+
163+
Libraries
164+
-----------------------
165+
166+
- [`RangeInclusive` now checks for exhaustion when calling `contains` and indexing.][78109]
167+
- [`ToString::to_string` now no longer shrinks the internal buffer in the default implementation.][77997]
168+
169+
Stabilized APIs
170+
---------------
171+
172+
- [`slice::select_nth_unstable`]
173+
- [`slice::select_nth_unstable_by`]
174+
- [`slice::select_nth_unstable_by_key`]
175+
176+
The following previously stable methods are now `const`.
177+
178+
- [`Poll::is_ready`]
179+
- [`Poll::is_pending`]
180+
181+
Cargo
182+
-----------------------
183+
- [Building a crate with `cargo-package` should now be independently reproducible.][cargo/8864]
184+
- [`cargo-tree` now marks proc-macro crates.][cargo/8765]
185+
- [Added `CARGO_PRIMARY_PACKAGE` build-time environment variable.][cargo/8758] This
186+
variable will be set if the crate being built is one the user selected to build, either
187+
with `-p` or through defaults.
188+
- [You can now use glob patterns when specifying packages & targets.][cargo/8752]
189+
190+
191+
Compatibility Notes
192+
-------------------
193+
194+
- [Demoted `i686-unknown-freebsd` from host tier 2 to target tier 2 support.][78746]
195+
- [Macros that end with a semi-colon are now treated as statements even if they expand to nothing.][78376]
196+
- [Rustc will now check for the validity of some built-in attributes on enum variants.][77015]
197+
Previously such invalid or unused attributes could be ignored.
198+
- Leading whitespace is stripped more uniformly in documentation comments, which may change behavior. You
199+
read [this post about the changes][rustdoc-ws-post] for more details.
200+
- [Trait bounds are no longer inferred for associated types.][79904]
201+
202+
Internal Only
203+
-------------
204+
These changes provide no direct user facing benefits, but represent significant
205+
improvements to the internals and overall performance of rustc and
206+
related tools.
207+
208+
- [rustc's internal crates are now compiled using the `initial-exec` Thread
209+
Local Storage model.][78201]
210+
- [Calculate visibilities once in resolve.][78077]
211+
- [Added `system` to the `llvm-libunwind` bootstrap config option.][77703]
212+
- [Added `--color` for configuring terminal color support to bootstrap.][79004]
213+
214+
215+
[75991]: https://github.com/rust-lang/rust/pull/75991
216+
[78951]: https://github.com/rust-lang/rust/pull/78951
217+
[78848]: https://github.com/rust-lang/rust/pull/78848
218+
[78746]: https://github.com/rust-lang/rust/pull/78746
219+
[78376]: https://github.com/rust-lang/rust/pull/78376
220+
[78228]: https://github.com/rust-lang/rust/pull/78228
221+
[78227]: https://github.com/rust-lang/rust/pull/78227
222+
[78201]: https://github.com/rust-lang/rust/pull/78201
223+
[78109]: https://github.com/rust-lang/rust/pull/78109
224+
[78077]: https://github.com/rust-lang/rust/pull/78077
225+
[77997]: https://github.com/rust-lang/rust/pull/77997
226+
[77703]: https://github.com/rust-lang/rust/pull/77703
227+
[77547]: https://github.com/rust-lang/rust/pull/77547
228+
[77015]: https://github.com/rust-lang/rust/pull/77015
229+
[76199]: https://github.com/rust-lang/rust/pull/76199
230+
[76119]: https://github.com/rust-lang/rust/pull/76119
231+
[75914]: https://github.com/rust-lang/rust/pull/75914
232+
[79004]: https://github.com/rust-lang/rust/pull/79004
233+
[78676]: https://github.com/rust-lang/rust/pull/78676
234+
[79904]: https://github.com/rust-lang/rust/issues/79904
235+
[cargo/8864]: https://github.com/rust-lang/cargo/pull/8864
236+
[cargo/8765]: https://github.com/rust-lang/cargo/pull/8765
237+
[cargo/8758]: https://github.com/rust-lang/cargo/pull/8758
238+
[cargo/8752]: https://github.com/rust-lang/cargo/pull/8752
239+
[`slice::select_nth_unstable`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.select_nth_unstable
240+
[`slice::select_nth_unstable_by`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.select_nth_unstable_by
241+
[`slice::select_nth_unstable_by_key`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.select_nth_unstable_by_key
242+
[`hint::spin_loop`]: https://doc.rust-lang.org/stable/std/hint/fn.spin_loop.html
243+
[`Poll::is_ready`]: https://doc.rust-lang.org/stable/std/task/enum.Poll.html#method.is_ready
244+
[`Poll::is_pending`]: https://doc.rust-lang.org/stable/std/task/enum.Poll.html#method.is_pending
245+
[rustdoc-ws-post]: https://blog.guillaume-gomez.fr/articles/2020-11-11+New+doc+comment+handling+in+rustdoc
246+
1247
Version 1.48.0 (2020-11-19)
2248
==========================
3249

@@ -10,7 +256,7 @@ Language
10256
Compiler
11257
--------
12258
- [Stabilised the `-C link-self-contained=<yes|no>` compiler flag.][76158] This tells
13-
`rustc` whether to link its own C runtime and libraries or to rely on a external
259+
`rustc` whether to link its own C runtime and libraries or to rely on a external
14260
linker to find them. (Supported only on `windows-gnu`, `linux-musl`, and `wasi` platforms.)
15261
- [You can now use `-C target-feature=+crt-static` on `linux-gnu` targets.][77386]
16262
Note: If you're using cargo you must explicitly pass the `--target` flag.
@@ -82,7 +328,7 @@ Compatibility Notes
82328
- [Foreign exceptions are now caught by `catch_unwind` and will cause an abort.][70212]
83329
Note: This behaviour is not guaranteed and is still considered undefined behaviour,
84330
see the [`catch_unwind`] documentation for further information.
85-
331+
86332

87333

88334
Internal Only
@@ -102,7 +348,7 @@ related tools.
102348
[76030]: https://github.com/rust-lang/rust/pull/76030/
103349
[70212]: https://github.com/rust-lang/rust/pull/70212/
104350
[27675]: https://github.com/rust-lang/rust/issues/27675/
105-
[54121]: https://github.com/rust-lang/rust/issues/54121/
351+
[54121]: https://github.com/rust-lang/rust/issues/54121/
106352
[71274]: https://github.com/rust-lang/rust/pull/71274/
107353
[77386]: https://github.com/rust-lang/rust/pull/77386/
108354
[77153]: https://github.com/rust-lang/rust/pull/77153/

compiler/rustc_parse/src/lexer/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,15 @@ impl<'a> StringReader<'a> {
532532
if let Err(err) = result {
533533
let span_with_quotes =
534534
self.mk_sp(content_start - BytePos(1), content_end + BytePos(1));
535+
let (start, end) = (range.start as u32, range.end as u32);
536+
let lo = content_start + BytePos(start);
537+
let hi = lo + BytePos(end - start);
538+
let span = self.mk_sp(lo, hi);
535539
emit_unescape_error(
536540
&self.sess.span_diagnostic,
537541
lit_content,
538542
span_with_quotes,
543+
span,
539544
mode,
540545
range,
541546
err,

compiler/rustc_parse/src/lexer/unescape_error_reporting.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ pub(crate) fn emit_unescape_error(
1313
lit: &str,
1414
// full span of the literal, including quotes
1515
span_with_quotes: Span,
16+
// interior span of the literal, without quotes
17+
span: Span,
1618
mode: Mode,
1719
// range of the error inside `lit`
1820
range: Range<usize>,
@@ -26,13 +28,6 @@ pub(crate) fn emit_unescape_error(
2628
range,
2729
error
2830
);
29-
let span = {
30-
let Range { start, end } = range;
31-
let (start, end) = (start as u32, end as u32);
32-
let lo = span_with_quotes.lo() + BytePos(start + 1);
33-
let hi = lo + BytePos(end - start);
34-
span_with_quotes.with_lo(lo).with_hi(hi)
35-
};
3631
let last_char = || {
3732
let c = lit[range.clone()].chars().rev().next().unwrap();
3833
let span = span.with_lo(span.hi() - BytePos(c.len_utf8() as u32));

src/ci/run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fi
6363
#
6464
# FIXME: need a scheme for changing this `nightly` value to `beta` and `stable`
6565
# either automatically or manually.
66-
export RUST_RELEASE_CHANNEL=beta
66+
export RUST_RELEASE_CHANNEL=stable
6767

6868
# Always set the release channel for bootstrap; this is normally not important (i.e., only dist
6969
# builds would seem to matter) but in practice bootstrap wants to know whether we're targeting
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#![feature(rustc_attrs)]
2+
3+
#[rustc_dummy = b"ffi.rs"] //~ ERROR byte constant must be ASCII
4+
//~| ERROR byte constant must be ASCII
5+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: byte constant must be ASCII. Use a \xHH escape for a non-ASCII byte
2+
--> $DIR/key-value-non-ascii.rs:3:19
3+
|
4+
LL | #[rustc_dummy = b"ffi.rs"]
5+
| ^
6+
7+
error: byte constant must be ASCII. Use a \xHH escape for a non-ASCII byte
8+
--> $DIR/key-value-non-ascii.rs:3:21
9+
|
10+
LL | #[rustc_dummy = b"ffi.rs"]
11+
| ^^^
12+
13+
error: aborting due to 2 previous errors
14+

0 commit comments

Comments
 (0)