Skip to content

Commit bf62f4d

Browse files
committed
Auto merge of #86413 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] Bootstrap from stable This is the follow up to master/beta promotion, as well as the first round of backports: * Revert "Allow specifying alignment for functions #81234" * Revert #85176 addition of clone_from for ManuallyDrop #85758 * rustdoc: revert deref recur to resume inclusion of impl ExtTrait<Local> for ExtType #84867 * [beta] Update cargo #86563 r? `@Mark-Simulacrum`
2 parents 3198c52 + c4aeccd commit bf62f4d

File tree

37 files changed

+388
-337
lines changed

37 files changed

+388
-337
lines changed

RELEASES.md

+207-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,209 @@
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+
- [The added `BITS` constant may conflict with external definitions.][85667]
120+
In particular, this was known to be a problem in the `lexical-core` crate,
121+
but they have published fixes for semantic versions 0.4 through 0.7. To
122+
update this dependency alone, use `cargo update -p lexical-core`.
123+
124+
Internal Only
125+
-------------
126+
These changes provide no direct user facing benefits, but represent significant
127+
improvements to the internals and overall performance of rustc and
128+
related tools.
129+
130+
- [Rework the `std::sys::windows::alloc` implementation.][83065]
131+
- [rustdoc: Don't enter an infer_ctxt in get_blanket_impls for impls that aren't blanket impls.][82864]
132+
- [rustdoc: Only look at blanket impls in `get_blanket_impls`][83681]
133+
- [Rework rustdoc const type][82873]
134+
135+
[85667]: https://github.com/rust-lang/rust/pull/85667
136+
[83386]: https://github.com/rust-lang/rust/pull/83386
137+
[82771]: https://github.com/rust-lang/rust/pull/82771
138+
[84147]: https://github.com/rust-lang/rust/pull/84147
139+
[84082]: https://github.com/rust-lang/rust/pull/84082
140+
[83799]: https://github.com/rust-lang/rust/pull/83799
141+
[83681]: https://github.com/rust-lang/rust/pull/83681
142+
[83652]: https://github.com/rust-lang/rust/pull/83652
143+
[83387]: https://github.com/rust-lang/rust/pull/83387
144+
[82873]: https://github.com/rust-lang/rust/pull/82873
145+
[82864]: https://github.com/rust-lang/rust/pull/82864
146+
[82608]: https://github.com/rust-lang/rust/pull/82608
147+
[82565]: https://github.com/rust-lang/rust/pull/82565
148+
[80525]: https://github.com/rust-lang/rust/pull/80525
149+
[79278]: https://github.com/rust-lang/rust/pull/79278
150+
[78618]: https://github.com/rust-lang/rust/pull/78618
151+
[77704]: https://github.com/rust-lang/rust/pull/77704
152+
[83941]: https://github.com/rust-lang/rust/pull/83941
153+
[83065]: https://github.com/rust-lang/rust/pull/83065
154+
[81764]: https://github.com/rust-lang/rust/pull/81764
155+
[81469]: https://github.com/rust-lang/rust/pull/81469
156+
[cargo/9298]: https://github.com/rust-lang/cargo/pull/9298
157+
[cargo/9282]: https://github.com/rust-lang/cargo/pull/9282
158+
[cargo/9392]: https://github.com/rust-lang/cargo/pull/9392
159+
[`char::MAX`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.MAX
160+
[`char::REPLACEMENT_CHARACTER`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.REPLACEMENT_CHARACTER
161+
[`char::UNICODE_VERSION`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.UNICODE_VERSION
162+
[`char::decode_utf16`]: https://doc.rust-lang.org/std/primitive.char.html#method.decode_utf16
163+
[`char::from_u32`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32
164+
[`char::from_u32_unchecked`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32_unchecked
165+
[`char::from_digit`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_digit
166+
[`AtomicBool::fetch_update`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicBool.html#method.fetch_update
167+
[`AtomicPtr::fetch_update`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicPtr.html#method.fetch_update
168+
[`BTreeMap::retain`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.retain
169+
[`BTreeSet::retain`]: https://doc.rust-lang.org/std/collections/struct.BTreeSet.html#method.retain
170+
[`BufReader::seek_relative`]: https://doc.rust-lang.org/std/io/struct.BufReader.html#method.seek_relative
171+
[`DebugStruct::non_exhaustive`]: https://doc.rust-lang.org/std/fmt/struct.DebugStruct.html#method.finish_non_exhaustive
172+
[`Duration::MAX`]: https://doc.rust-lang.org/std/time/struct.Duration.html#associatedconstant.MAX
173+
[`Duration::ZERO`]: https://doc.rust-lang.org/std/time/struct.Duration.html#associatedconstant.ZERO
174+
[`Duration::is_zero`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.is_zero
175+
[`Duration::saturating_add`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.saturating_add
176+
[`Duration::saturating_mul`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.saturating_mul
177+
[`Duration::saturating_sub`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.saturating_sub
178+
[`ErrorKind::Unsupported`]: https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.Unsupported
179+
[`Option::insert`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.insert
180+
[`Ordering::is_eq`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_eq
181+
[`Ordering::is_ge`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_ge
182+
[`Ordering::is_gt`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_gt
183+
[`Ordering::is_le`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_le
184+
[`Ordering::is_lt`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_lt
185+
[`Ordering::is_ne`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_ne
186+
[`OsStr::eq_ignore_ascii_case`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.eq_ignore_ascii_case
187+
[`OsStr::is_ascii`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.is_ascii
188+
[`OsStr::make_ascii_lowercase`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.make_ascii_lowercase
189+
[`OsStr::make_ascii_uppercase`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.make_ascii_uppercase
190+
[`OsStr::to_ascii_lowercase`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.to_ascii_lowercase
191+
[`OsStr::to_ascii_uppercase`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.to_ascii_uppercase
192+
[`Peekable::peek_mut`]: https://doc.rust-lang.org/std/iter/struct.Peekable.html#method.peek_mut
193+
[`Rc::decrement_strong_count`]: https://doc.rust-lang.org/std/rc/struct.Rc.html#method.increment_strong_count
194+
[`Rc::increment_strong_count`]: https://doc.rust-lang.org/std/rc/struct.Rc.html#method.increment_strong_count
195+
[`Vec::extend_from_within`]: https://doc.rust-lang.org/beta/std/vec/struct.Vec.html#method.extend_from_within
196+
[`array::from_mut`]: https://doc.rust-lang.org/beta/std/array/fn.from_mut.html
197+
[`array::from_ref`]: https://doc.rust-lang.org/beta/std/array/fn.from_ref.html
198+
[`cmp::max_by_key`]: https://doc.rust-lang.org/beta/std/cmp/fn.max_by_key.html
199+
[`cmp::max_by`]: https://doc.rust-lang.org/beta/std/cmp/fn.max_by.html
200+
[`cmp::min_by_key`]: https://doc.rust-lang.org/beta/std/cmp/fn.min_by_key.html
201+
[`cmp::min_by`]: https://doc.rust-lang.org/beta/std/cmp/fn.min_by.html
202+
[`f32::is_subnormal`]: https://doc.rust-lang.org/std/primitive.f64.html#method.is_subnormal
203+
[`f64::is_subnormal`]: https://doc.rust-lang.org/std/primitive.f64.html#method.is_subnormal
204+
[ietf6943]: https://datatracker.ietf.org/doc/html/rfc6943#section-3.1.1
205+
206+
1207
Version 1.52.1 (2021-05-10)
2208
============================
3209

@@ -174,7 +380,7 @@ Language
174380
--------
175381
- [You can now parameterize items such as functions, traits, and `struct`s by constant
176382
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,
383+
E.g. you can now write the following. Note: Only values of primitive integers,
178384
`bool`, or `char` types are currently permitted.
179385
```rust
180386
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
@@ -279,9 +279,6 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
279279
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::CMSE_NONSECURE_ENTRY) {
280280
llvm::AddFunctionAttrString(llfn, Function, cstr!("cmse_nonsecure_entry"));
281281
}
282-
if let Some(align) = codegen_fn_attrs.alignment {
283-
llvm::set_alignment(llfn, align as usize);
284-
}
285282
sanitize(cx, codegen_fn_attrs.no_sanitize, llfn);
286283

287284
// 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
@@ -626,9 +626,6 @@ declare_features! (
626626
/// Allows `extern "C-unwind" fn` to enable unwinding across ABI boundaries.
627627
(active, c_unwind, "1.52.0", Some(74990), None),
628628

629-
/// Allows using `#[repr(align(...))]` on function items
630-
(active, fn_align, "1.53.0", Some(82232), None),
631-
632629
/// Allows `extern "wasm" fn`
633630
(active, wasm_abi, "1.53.0", Some(83788), None),
634631

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

compiler/rustc_passes/src/check_attr.rs

+6-40
Original file line numberDiff line numberDiff line change
@@ -1193,41 +1193,17 @@ impl CheckAttrVisitor<'tcx> {
11931193
let mut is_transparent = false;
11941194

11951195
for hint in &hints {
1196-
if !hint.is_meta_item() {
1197-
struct_span_err!(
1198-
self.tcx.sess,
1199-
hint.span(),
1200-
E0565,
1201-
"meta item in `repr` must be an identifier"
1202-
)
1203-
.emit();
1204-
continue;
1205-
}
1206-
12071196
let (article, allowed_targets) = match hint.name_or_empty() {
1208-
sym::C => {
1209-
is_c = true;
1197+
_ if !matches!(target, Target::Struct | Target::Enum | Target::Union) => {
1198+
("a", "struct, enum, or union")
1199+
}
1200+
name @ sym::C | name @ sym::align => {
1201+
is_c |= name == sym::C;
12101202
match target {
12111203
Target::Struct | Target::Union | Target::Enum => continue,
12121204
_ => ("a", "struct, enum, or union"),
12131205
}
12141206
}
1215-
sym::align => {
1216-
if let (Target::Fn, true) = (target, !self.tcx.features().fn_align) {
1217-
feature_err(
1218-
&self.tcx.sess.parse_sess,
1219-
sym::fn_align,
1220-
hint.span(),
1221-
"`repr(align)` attributes on functions are unstable",
1222-
)
1223-
.emit();
1224-
}
1225-
1226-
match target {
1227-
Target::Struct | Target::Union | Target::Enum | Target::Fn => continue,
1228-
_ => ("a", "struct, enum, function, or union"),
1229-
}
1230-
}
12311207
sym::packed => {
12321208
if target != Target::Struct && target != Target::Union {
12331209
("a", "struct or union")
@@ -1284,17 +1260,7 @@ impl CheckAttrVisitor<'tcx> {
12841260
continue;
12851261
}
12861262
}
1287-
_ => {
1288-
struct_span_err!(
1289-
self.tcx.sess,
1290-
hint.span(),
1291-
E0552,
1292-
"unrecognized representation hint"
1293-
)
1294-
.emit();
1295-
1296-
continue;
1297-
}
1263+
_ => continue,
12981264
};
12991265

13001266
struct_span_err!(

0 commit comments

Comments
 (0)