Skip to content

Commit dbe03e2

Browse files
committed
Auto merge of rust-lang#86317 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[stable] 1.53.0 release This includes a backport of: * Revert "implement TrustedRandomAccess for Take iterator adapter" rust-lang#85975 And includes patches to: * Update release notes to reflect rust-lang#85541 * Require RUSTC_FORCE_INCREMENTAL to truly enable incremental, fixing rust-lang#86004 * This reverts alignment-related commits to address issue rust-lang#85713 on beta. r? `@Mark-Simulacrum`
2 parents e7a67cc + 196e185 commit dbe03e2

File tree

27 files changed

+349
-173
lines changed

27 files changed

+349
-173
lines changed

RELEASES.md

+204-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,205 @@
1+
Version 1.53.0 (2021-06-17)
2+
============================
3+
4+
Language
5+
-----------------------
6+
- [You can now use unicode for identifiers.][83799] This allows multilingual
7+
identifiers but still doesn't allow glyphs that are not considered characters
8+
such as `◆` or `🦀`. More specifically you can now use any identifier that
9+
matches the UAX #31 "Unicode Identifier and Pattern Syntax" standard. This
10+
is the same standard as languages like Python, however Rust uses NFC
11+
normalization which may be different from other languages.
12+
- [You can now specify "or patterns" inside pattern matches.][79278]
13+
Previously you could only use `|` (OR) on complete patterns. E.g.
14+
```rust
15+
let x = Some(2u8);
16+
// Before
17+
matches!(x, Some(1) | Some(2));
18+
// Now
19+
matches!(x, Some(1 | 2));
20+
```
21+
- [Added the `:pat_param` `macro_rules!` matcher.][83386] This matcher
22+
has the same semantics as the `:pat` matcher. This is to allow `:pat`
23+
to change semantics to being a pattern fragment in a future edition.
24+
25+
Compiler
26+
-----------------------
27+
- [Updated the minimum external LLVM version to LLVM 10.][83387]
28+
- [Added Tier 3\* support for the `wasm64-unknown-unknown` target.][80525]
29+
- [Improved debuginfo for closures and async functions on Windows MSVC.][83941]
30+
31+
\* Refer to Rust's [platform support page][platform-support-doc] for more
32+
information on Rust's tiered platform support.
33+
34+
Libraries
35+
-----------------------
36+
- [Abort messages will now forward to `android_set_abort_message` on
37+
Android platforms when available.][81469]
38+
- [`slice::IterMut<'_, T>` now implements `AsRef<[T]>`][82771]
39+
- [Arrays of any length now implement `IntoIterator`.][84147]
40+
Currently calling `.into_iter()` as a method on an array will
41+
return `impl Iterator<Item=&T>`, but this may change in a
42+
future edition to change `Item` to `T`. Calling `IntoIterator::into_iter`
43+
directly on arrays will provide `impl Iterator<Item=T>` as expected.
44+
- [`leading_zeros`, and `trailing_zeros` are now available on all
45+
`NonZero` integer types.][84082]
46+
- [`{f32, f64}::from_str` now parse and print special values
47+
(`NaN`, `-0`) according to IEEE RFC 754.][78618]
48+
- [You can now index into slices using `(Bound<usize>, Bound<usize>)`.][77704]
49+
- [Add the `BITS` associated constant to all numeric types.][82565]
50+
51+
Stabilised APIs
52+
---------------
53+
- [`AtomicBool::fetch_update`]
54+
- [`AtomicPtr::fetch_update`]
55+
- [`BTreeMap::retain`]
56+
- [`BTreeSet::retain`]
57+
- [`BufReader::seek_relative`]
58+
- [`DebugStruct::non_exhaustive`]
59+
- [`Duration::MAX`]
60+
- [`Duration::ZERO`]
61+
- [`Duration::is_zero`]
62+
- [`Duration::saturating_add`]
63+
- [`Duration::saturating_mul`]
64+
- [`Duration::saturating_sub`]
65+
- [`ErrorKind::Unsupported`]
66+
- [`Option::insert`]
67+
- [`Ordering::is_eq`]
68+
- [`Ordering::is_ge`]
69+
- [`Ordering::is_gt`]
70+
- [`Ordering::is_le`]
71+
- [`Ordering::is_lt`]
72+
- [`Ordering::is_ne`]
73+
- [`OsStr::is_ascii`]
74+
- [`OsStr::make_ascii_lowercase`]
75+
- [`OsStr::make_ascii_uppercase`]
76+
- [`OsStr::to_ascii_lowercase`]
77+
- [`OsStr::to_ascii_uppercase`]
78+
- [`Peekable::peek_mut`]
79+
- [`Rc::decrement_strong_count`]
80+
- [`Rc::increment_strong_count`]
81+
- [`Vec::extend_from_within`]
82+
- [`array::from_mut`]
83+
- [`array::from_ref`]
84+
- [`char::MAX`]
85+
- [`char::REPLACEMENT_CHARACTER`]
86+
- [`char::UNICODE_VERSION`]
87+
- [`char::decode_utf16`]
88+
- [`char::from_digit`]
89+
- [`char::from_u32_unchecked`]
90+
- [`char::from_u32`]
91+
- [`cmp::max_by_key`]
92+
- [`cmp::max_by`]
93+
- [`cmp::min_by_key`]
94+
- [`cmp::min_by`]
95+
- [`f32::is_subnormal`]
96+
- [`f64::is_subnormal`]
97+
98+
Cargo
99+
-----------------------
100+
- [Cargo now supports git repositories where the default `HEAD` branch is not
101+
"master".][cargo/9392] This also includes a switch to the version 3 `Cargo.lock` format
102+
which can handle default branches correctly.
103+
- [macOS targets now default to `unpacked` split-debuginfo.][cargo/9298]
104+
- [The `authors` field is no longer included in `Cargo.toml` for new
105+
projects.][cargo/9282]
106+
107+
Rustdoc
108+
-----------------------
109+
- [Added the `rustdoc::bare_urls` lint that warns when you have URLs
110+
without hyperlinks.][81764]
111+
112+
Compatibility Notes
113+
-------------------
114+
- [Implement token-based handling of attributes during expansion][82608]
115+
- [`Ipv4::from_str` will now reject octal format IP addresses in addition
116+
to rejecting hexadecimal IP addresses.][83652] The octal format can lead
117+
to confusion and potential security vulnerabilities and [is no
118+
longer recommended][ietf6943].
119+
120+
121+
Internal Only
122+
-------------
123+
These changes provide no direct user facing benefits, but represent significant
124+
improvements to the internals and overall performance of rustc and
125+
related tools.
126+
127+
- [Rework the `std::sys::windows::alloc` implementation.][83065]
128+
- [rustdoc: Don't enter an infer_ctxt in get_blanket_impls for impls that aren't blanket impls.][82864]
129+
- [rustdoc: Only look at blanket impls in `get_blanket_impls`][83681]
130+
- [Rework rustdoc const type][82873]
131+
132+
[83386]: https://github.com/rust-lang/rust/pull/83386
133+
[82771]: https://github.com/rust-lang/rust/pull/82771
134+
[84147]: https://github.com/rust-lang/rust/pull/84147
135+
[84082]: https://github.com/rust-lang/rust/pull/84082
136+
[83799]: https://github.com/rust-lang/rust/pull/83799
137+
[83681]: https://github.com/rust-lang/rust/pull/83681
138+
[83652]: https://github.com/rust-lang/rust/pull/83652
139+
[83387]: https://github.com/rust-lang/rust/pull/83387
140+
[82873]: https://github.com/rust-lang/rust/pull/82873
141+
[82864]: https://github.com/rust-lang/rust/pull/82864
142+
[82608]: https://github.com/rust-lang/rust/pull/82608
143+
[82565]: https://github.com/rust-lang/rust/pull/82565
144+
[80525]: https://github.com/rust-lang/rust/pull/80525
145+
[79278]: https://github.com/rust-lang/rust/pull/79278
146+
[78618]: https://github.com/rust-lang/rust/pull/78618
147+
[77704]: https://github.com/rust-lang/rust/pull/77704
148+
[83941]: https://github.com/rust-lang/rust/pull/83941
149+
[83065]: https://github.com/rust-lang/rust/pull/83065
150+
[81764]: https://github.com/rust-lang/rust/pull/81764
151+
[81469]: https://github.com/rust-lang/rust/pull/81469
152+
[cargo/9298]: https://github.com/rust-lang/cargo/pull/9298
153+
[cargo/9282]: https://github.com/rust-lang/cargo/pull/9282
154+
[cargo/9392]: https://github.com/rust-lang/cargo/pull/9392
155+
[`char::MAX`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.MAX
156+
[`char::REPLACEMENT_CHARACTER`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.REPLACEMENT_CHARACTER
157+
[`char::UNICODE_VERSION`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.UNICODE_VERSION
158+
[`char::decode_utf16`]: https://doc.rust-lang.org/std/primitive.char.html#method.decode_utf16
159+
[`char::from_u32`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32
160+
[`char::from_u32_unchecked`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32_unchecked
161+
[`char::from_digit`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_digit
162+
[`AtomicBool::fetch_update`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicBool.html#method.fetch_update
163+
[`AtomicPtr::fetch_update`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicPtr.html#method.fetch_update
164+
[`BTreeMap::retain`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.retain
165+
[`BTreeSet::retain`]: https://doc.rust-lang.org/std/collections/struct.BTreeSet.html#method.retain
166+
[`BufReader::seek_relative`]: https://doc.rust-lang.org/std/io/struct.BufReader.html#method.seek_relative
167+
[`DebugStruct::non_exhaustive`]: https://doc.rust-lang.org/std/fmt/struct.DebugStruct.html#method.finish_non_exhaustive
168+
[`Duration::MAX`]: https://doc.rust-lang.org/std/time/struct.Duration.html#associatedconstant.MAX
169+
[`Duration::ZERO`]: https://doc.rust-lang.org/std/time/struct.Duration.html#associatedconstant.ZERO
170+
[`Duration::is_zero`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.is_zero
171+
[`Duration::saturating_add`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.saturating_add
172+
[`Duration::saturating_mul`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.saturating_mul
173+
[`Duration::saturating_sub`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.saturating_sub
174+
[`ErrorKind::Unsupported`]: https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.Unsupported
175+
[`Option::insert`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.insert
176+
[`Ordering::is_eq`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_eq
177+
[`Ordering::is_ge`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_ge
178+
[`Ordering::is_gt`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_gt
179+
[`Ordering::is_le`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_le
180+
[`Ordering::is_lt`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_lt
181+
[`Ordering::is_ne`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_ne
182+
[`OsStr::eq_ignore_ascii_case`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.eq_ignore_ascii_case
183+
[`OsStr::is_ascii`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.is_ascii
184+
[`OsStr::make_ascii_lowercase`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.make_ascii_lowercase
185+
[`OsStr::make_ascii_uppercase`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.make_ascii_uppercase
186+
[`OsStr::to_ascii_lowercase`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.to_ascii_lowercase
187+
[`OsStr::to_ascii_uppercase`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.to_ascii_uppercase
188+
[`Peekable::peek_mut`]: https://doc.rust-lang.org/std/iter/struct.Peekable.html#method.peek_mut
189+
[`Rc::decrement_strong_count`]: https://doc.rust-lang.org/std/rc/struct.Rc.html#method.increment_strong_count
190+
[`Rc::increment_strong_count`]: https://doc.rust-lang.org/std/rc/struct.Rc.html#method.increment_strong_count
191+
[`Vec::extend_from_within`]: https://doc.rust-lang.org/beta/std/vec/struct.Vec.html#method.extend_from_within
192+
[`array::from_mut`]: https://doc.rust-lang.org/beta/std/array/fn.from_mut.html
193+
[`array::from_ref`]: https://doc.rust-lang.org/beta/std/array/fn.from_ref.html
194+
[`cmp::max_by_key`]: https://doc.rust-lang.org/beta/std/cmp/fn.max_by_key.html
195+
[`cmp::max_by`]: https://doc.rust-lang.org/beta/std/cmp/fn.max_by.html
196+
[`cmp::min_by_key`]: https://doc.rust-lang.org/beta/std/cmp/fn.min_by_key.html
197+
[`cmp::min_by`]: https://doc.rust-lang.org/beta/std/cmp/fn.min_by.html
198+
[`f32::is_subnormal`]: https://doc.rust-lang.org/std/primitive.f64.html#method.is_subnormal
199+
[`f64::is_subnormal`]: https://doc.rust-lang.org/std/primitive.f64.html#method.is_subnormal
200+
[ietf6943]: https://datatracker.ietf.org/doc/html/rfc6943#section-3.1.1
201+
202+
1203
Version 1.52.1 (2021-05-10)
2204
============================
3205

@@ -79,7 +281,7 @@ The following previously stable APIs are now `const`.
79281
Rustdoc
80282
-------
81283
- [Rustdoc lints are now treated as a tool lint, meaning that
82-
lints are now prefixed with `rustdoc::` (e.g. `#[warn(rustdoc::non_autolinks)]`).][80527]
284+
lints are now prefixed with `rustdoc::` (e.g. `#[warn(rustdoc::broken_intra_doc_links)]`).][80527]
83285
Using the old style is still allowed, and will become a warning in
84286
a future release.
85287
- [Rustdoc now supports argument files.][82261]
@@ -174,7 +376,7 @@ Language
174376
--------
175377
- [You can now parameterize items such as functions, traits, and `struct`s by constant
176378
values in addition to by types and lifetimes.][79135] Also known as "const generics"
177-
E.g. you can now write the following. Note: Only values of primitive integers,
379+
E.g. you can now write the following. Note: Only values of primitive integers,
178380
`bool`, or `char` types are currently permitted.
179381
```rust
180382
struct GenericArray<T, const LENGTH: usize> {

compiler/rustc_attr/src/builtin.rs

+36-14
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,18 @@ pub fn find_repr_attrs(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
862862
if let Some(items) = attr.meta_item_list() {
863863
sess.mark_attr_used(attr);
864864
for item in items {
865+
if !item.is_meta_item() {
866+
handle_errors(
867+
&sess.parse_sess,
868+
item.span(),
869+
AttrError::UnsupportedLiteral(
870+
"meta item in `repr` must be an identifier",
871+
false,
872+
),
873+
);
874+
continue;
875+
}
876+
865877
let mut recognised = false;
866878
if item.is_word() {
867879
let hint = match item.name_or_empty() {
@@ -878,6 +890,23 @@ pub fn find_repr_attrs(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
878890
acc.push(h);
879891
}
880892
} else if let Some((name, value)) = item.name_value_literal() {
893+
let parse_alignment = |node: &ast::LitKind| -> Result<u32, &'static str> {
894+
if let ast::LitKind::Int(literal, ast::LitIntType::Unsuffixed) = node {
895+
if literal.is_power_of_two() {
896+
// rustc_middle::ty::layout::Align restricts align to <= 2^29
897+
if *literal <= 1 << 29 {
898+
Ok(*literal as u32)
899+
} else {
900+
Err("larger than 2^29")
901+
}
902+
} else {
903+
Err("not a power of two")
904+
}
905+
} else {
906+
Err("not an unsuffixed integer")
907+
}
908+
};
909+
881910
let mut literal_error = None;
882911
if name == sym::align {
883912
recognised = true;
@@ -937,7 +966,13 @@ pub fn find_repr_attrs(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
937966
}
938967
if !recognised {
939968
// Not a word we recognize
940-
diagnostic.delay_span_bug(item.span(), "unrecognized representation hint");
969+
struct_span_err!(
970+
diagnostic,
971+
item.span(),
972+
E0552,
973+
"unrecognized representation hint"
974+
)
975+
.emit();
941976
}
942977
}
943978
}
@@ -1045,16 +1080,3 @@ fn allow_unstable<'a>(
10451080
name
10461081
})
10471082
}
1048-
1049-
pub fn parse_alignment(node: &ast::LitKind) -> Result<u32, &'static str> {
1050-
if let ast::LitKind::Int(literal, ast::LitIntType::Unsuffixed) = node {
1051-
if literal.is_power_of_two() {
1052-
// rustc_middle::ty::layout::Align restricts align to <= 2^29
1053-
if *literal <= 1 << 29 { Ok(*literal as u32) } else { Err("larger than 2^29") }
1054-
} else {
1055-
Err("not a power of two")
1056-
}
1057-
} else {
1058-
Err("not an unsuffixed integer")
1059-
}
1060-
}

compiler/rustc_codegen_llvm/src/attributes.rs

-3
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,6 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
281281
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::CMSE_NONSECURE_ENTRY) {
282282
llvm::AddFunctionAttrString(llfn, Function, cstr!("cmse_nonsecure_entry"));
283283
}
284-
if let Some(align) = codegen_fn_attrs.alignment {
285-
llvm::set_alignment(llfn, align as usize);
286-
}
287284
sanitize(cx, codegen_fn_attrs.no_sanitize, llfn);
288285

289286
// Always annotate functions with the target-cpu they are compiled for.

compiler/rustc_feature/src/active.rs

-3
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,6 @@ declare_features! (
637637
/// Allows `extern "C-unwind" fn` to enable unwinding across ABI boundaries.
638638
(active, c_unwind, "1.52.0", Some(74990), None),
639639

640-
/// Allows using `#[repr(align(...))]` on function items
641-
(active, fn_align, "1.53.0", Some(82232), None),
642-
643640
/// Allows `extern "wasm" fn`
644641
(active, wasm_abi, "1.53.0", Some(83788), None),
645642

compiler/rustc_middle/src/middle/codegen_fn_attrs.rs

-4
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ pub struct CodegenFnAttrs {
3838
/// be generated against a specific instruction set. Only usable on architectures which allow
3939
/// switching between multiple instruction sets.
4040
pub instruction_set: Option<InstructionSetAttr>,
41-
/// The `#[repr(align(...))]` attribute. Indicates the value of which the function should be
42-
/// aligned to.
43-
pub alignment: Option<u32>,
4441
}
4542

4643
bitflags! {
@@ -110,7 +107,6 @@ impl CodegenFnAttrs {
110107
link_section: None,
111108
no_sanitize: SanitizerSet::empty(),
112109
instruction_set: None,
113-
alignment: None,
114110
}
115111
}
116112

0 commit comments

Comments
 (0)