Skip to content

Commit f8532b7

Browse files
authored
Merge branch 'rust-lang:master' into ignore-message
2 parents 679f4dd + 9ecd75b commit f8532b7

File tree

398 files changed

+6041
-3829
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

398 files changed

+6041
-3829
lines changed

Cargo.lock

+12-3
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ version = "0.2.14"
154154
source = "registry+https://github.com/rust-lang/crates.io-index"
155155
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
156156
dependencies = [
157-
"hermit-abi",
157+
"hermit-abi 0.1.19",
158158
"libc",
159159
"winapi",
160160
]
@@ -1610,6 +1610,15 @@ name = "hermit-abi"
16101610
version = "0.1.19"
16111611
source = "registry+https://github.com/rust-lang/crates.io-index"
16121612
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
1613+
dependencies = [
1614+
"libc",
1615+
]
1616+
1617+
[[package]]
1618+
name = "hermit-abi"
1619+
version = "0.2.0"
1620+
source = "registry+https://github.com/rust-lang/crates.io-index"
1621+
checksum = "1ab7905ea95c6d9af62940f9d7dd9596d54c334ae2c15300c482051292d5637f"
16131622
dependencies = [
16141623
"compiler_builtins",
16151624
"libc",
@@ -2396,7 +2405,7 @@ version = "1.13.1"
23962405
source = "registry+https://github.com/rust-lang/crates.io-index"
23972406
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
23982407
dependencies = [
2399-
"hermit-abi",
2408+
"hermit-abi 0.1.19",
24002409
"libc",
24012410
]
24022411

@@ -4782,7 +4791,7 @@ dependencies = [
47824791
"dlmalloc",
47834792
"fortanix-sgx-abi",
47844793
"hashbrown 0.12.0",
4785-
"hermit-abi",
4794+
"hermit-abi 0.2.0",
47864795
"libc",
47874796
"miniz_oxide",
47884797
"object 0.26.2",

RELEASES.md

+165
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,168 @@
1+
Version 1.59.0 (2022-02-24)
2+
==========================
3+
4+
Language
5+
--------
6+
7+
- [Stabilize default arguments for const generics][90207]
8+
- [Stabilize destructuring assignment][90521]
9+
- [Relax private in public lint on generic bounds and where clauses of trait impls][90586]
10+
- [Stabilize asm! and global_asm! for x86, x86_64, ARM, Aarch64, and RISC-V][91728]
11+
12+
Compiler
13+
--------
14+
15+
- [Stabilize new symbol mangling format, leaving it opt-in (-Csymbol-mangling-version=v0)][90128]
16+
- [Emit LLVM optimization remarks when enabled with `-Cremark`][90833]
17+
- [Fix sparc64 ABI for aggregates with floating point members][91003]
18+
- [Warn when a `#[test]`-like built-in attribute macro is present multiple times.][91172]
19+
- [Add support for riscv64gc-unknown-freebsd][91284]
20+
- [Stabilize `-Z emit-future-incompat` as `--json future-incompat`][91535]
21+
22+
Libraries
23+
---------
24+
25+
- [Remove unnecessary bounds for some Hash{Map,Set} methods][91593]
26+
27+
Stabilized APIs
28+
---------------
29+
30+
- [`std::thread::available_parallelism`][available_parallelism]
31+
- [`Result::copied`][result-copied]
32+
- [`Result::cloned`][result-cloned]
33+
- [`arch::asm!`][asm]
34+
- [`arch::global_asm!`][global_asm]
35+
- [`ops::ControlFlow::is_break`][is_break]
36+
- [`ops::ControlFlow::is_continue`][is_continue]
37+
- [`TryFrom<char> for u8`][try_from_char_u8]
38+
- [`char::TryFromCharError`][try_from_char_err]
39+
implementing `Clone`, `Debug`, `Display`, `PartialEq`, `Copy`, `Eq`, `Error`
40+
- [`iter::zip`][zip]
41+
- [`NonZeroU8::is_power_of_two`][is_power_of_two8]
42+
- [`NonZeroU16::is_power_of_two`][is_power_of_two16]
43+
- [`NonZeroU32::is_power_of_two`][is_power_of_two32]
44+
- [`NonZeroU64::is_power_of_two`][is_power_of_two64]
45+
- [`NonZeroU128::is_power_of_two`][is_power_of_two128]
46+
- [`DoubleEndedIterator for ToLowercase`][lowercase]
47+
- [`DoubleEndedIterator for ToUppercase`][uppercase]
48+
- [`TryFrom<&mut [T]> for [T; N]`][tryfrom_ref_arr]
49+
- [`UnwindSafe for Once`][unwindsafe_once]
50+
- [`RefUnwindSafe for Once`][refunwindsafe_once]
51+
- [armv8 neon intrinsics for aarch64][stdarch/1266]
52+
53+
Const-stable:
54+
55+
- [`mem::MaybeUninit::as_ptr`][muninit_ptr]
56+
- [`mem::MaybeUninit::assume_init`][muninit_init]
57+
- [`mem::MaybeUninit::assume_init_ref`][muninit_init_ref]
58+
- [`ffi::CStr::from_bytes_with_nul_unchecked`][cstr_from_bytes]
59+
60+
Cargo
61+
-----
62+
63+
- [Stabilize the `strip` profile option][cargo/10088]
64+
- [Stabilize future-incompat-report][cargo/10165]
65+
- [Support abbreviating `--release` as `-r`][cargo/10133]
66+
- [Support `term.quiet` configuration][cargo/10152]
67+
- [Remove `--host` from cargo {publish,search,login}][cargo/10145]
68+
69+
Compatibility Notes
70+
-------------------
71+
72+
- [Refactor weak symbols in std::sys::unix][90846]
73+
This may add new, versioned, symbols when building with a newer glibc, as the
74+
standard library uses weak linkage rather than dynamically attempting to load
75+
certain symbols at runtime.
76+
- [Deprecate crate_type and crate_name nested inside `#![cfg_attr]`][83744]
77+
This adds a future compatibility lint to supporting the use of cfg_attr
78+
wrapping either crate_type or crate_name specification within Rust files;
79+
it is recommended that users migrate to setting the equivalent command line
80+
flags.
81+
- [Remove effect of `#[no_link]` attribute on name resolution][92034]
82+
This may expose new names, leading to conflicts with preexisting names in a
83+
given namespace and a compilation failure.
84+
- [Cargo will document libraries before binaries.][cargo/10172]
85+
- [Respect doc=false in dependencies, not just the root crate][cargo/10201]
86+
- [Weaken guarantee around advancing underlying iterators in zip][83791]
87+
- [Make split_inclusive() on an empty slice yield an empty output][89825]
88+
- [Update std::env::temp_dir to use GetTempPath2 on Windows when available.][89999]
89+
90+
Internal Changes
91+
----------------
92+
93+
These changes provide no direct user facing benefits, but represent significant
94+
improvements to the internals and overall performance of rustc
95+
and related tools.
96+
97+
- [Fix many cases of normalization-related ICEs][91255]
98+
- [Replace dominators algorithm with simple Lengauer-Tarjan][85013]
99+
- [Store liveness in interval sets for region inference][90637]
100+
101+
- [Remove `in_band_lifetimes` from the compiler and standard library, in preparation for removing this
102+
unstable feature.][91867]
103+
104+
[91867]: https://github.com/rust-lang/rust/issues/91867
105+
[83744]: https://github.com/rust-lang/rust/pull/83744/
106+
[83791]: https://github.com/rust-lang/rust/pull/83791/
107+
[85013]: https://github.com/rust-lang/rust/pull/85013/
108+
[89825]: https://github.com/rust-lang/rust/pull/89825/
109+
[89999]: https://github.com/rust-lang/rust/pull/89999/
110+
[90128]: https://github.com/rust-lang/rust/pull/90128/
111+
[90207]: https://github.com/rust-lang/rust/pull/90207/
112+
[90521]: https://github.com/rust-lang/rust/pull/90521/
113+
[90586]: https://github.com/rust-lang/rust/pull/90586/
114+
[90637]: https://github.com/rust-lang/rust/pull/90637/
115+
[90833]: https://github.com/rust-lang/rust/pull/90833/
116+
[90846]: https://github.com/rust-lang/rust/pull/90846/
117+
[91003]: https://github.com/rust-lang/rust/pull/91003/
118+
[91172]: https://github.com/rust-lang/rust/pull/91172/
119+
[91255]: https://github.com/rust-lang/rust/pull/91255/
120+
[91284]: https://github.com/rust-lang/rust/pull/91284/
121+
[91535]: https://github.com/rust-lang/rust/pull/91535/
122+
[91593]: https://github.com/rust-lang/rust/pull/91593/
123+
[91728]: https://github.com/rust-lang/rust/pull/91728/
124+
[91878]: https://github.com/rust-lang/rust/pull/91878/
125+
[91896]: https://github.com/rust-lang/rust/pull/91896/
126+
[91926]: https://github.com/rust-lang/rust/pull/91926/
127+
[91984]: https://github.com/rust-lang/rust/pull/91984/
128+
[92020]: https://github.com/rust-lang/rust/pull/92020/
129+
[92034]: https://github.com/rust-lang/rust/pull/92034/
130+
[92483]: https://github.com/rust-lang/rust/pull/92483/
131+
[cargo/10088]: https://github.com/rust-lang/cargo/pull/10088/
132+
[cargo/10133]: https://github.com/rust-lang/cargo/pull/10133/
133+
[cargo/10145]: https://github.com/rust-lang/cargo/pull/10145/
134+
[cargo/10152]: https://github.com/rust-lang/cargo/pull/10152/
135+
[cargo/10165]: https://github.com/rust-lang/cargo/pull/10165/
136+
[cargo/10172]: https://github.com/rust-lang/cargo/pull/10172/
137+
[cargo/10201]: https://github.com/rust-lang/cargo/pull/10201/
138+
[cargo/10269]: https://github.com/rust-lang/cargo/pull/10269/
139+
140+
[cstr_from_bytes]: https://doc.rust-lang.org/stable/std/ffi/struct.CStr.html#method.from_bytes_with_nul_unchecked
141+
[muninit_ptr]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.as_ptr
142+
[muninit_init]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init
143+
[muninit_init_ref]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_ref
144+
[unwindsafe_once]: https://doc.rust-lang.org/stable/std/sync/struct.Once.html#impl-UnwindSafe
145+
[refunwindsafe_once]: https://doc.rust-lang.org/stable/std/sync/struct.Once.html#impl-RefUnwindSafe
146+
[tryfrom_ref_arr]: https://doc.rust-lang.org/stable/std/convert/trait.TryFrom.html#impl-TryFrom%3C%26%27_%20mut%20%5BT%5D%3E
147+
[lowercase]: https://doc.rust-lang.org/stable/std/char/struct.ToLowercase.html#impl-DoubleEndedIterator
148+
[uppercase]: https://doc.rust-lang.org/stable/std/char/struct.ToUppercase.html#impl-DoubleEndedIterator
149+
[try_from_char_err]: https://doc.rust-lang.org/stable/std/char/struct.TryFromCharError.html
150+
[available_parallelism]: https://doc.rust-lang.org/stable/std/thread/fn.available_parallelism.html
151+
[result-copied]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.copied
152+
[result-cloned]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.cloned
153+
[asm]: https://doc.rust-lang.org/stable/core/arch/macro.asm.html
154+
[global_asm]: https://doc.rust-lang.org/stable/core/arch/macro.global_asm.html
155+
[is_break]: https://doc.rust-lang.org/stable/std/ops/enum.ControlFlow.html#method.is_break
156+
[is_continue]: https://doc.rust-lang.org/stable/std/ops/enum.ControlFlow.html#method.is_continue
157+
[try_from_char_u8]: https://doc.rust-lang.org/stable/std/primitive.char.html#impl-TryFrom%3Cchar%3E
158+
[zip]: https://doc.rust-lang.org/stable/std/iter/fn.zip.html
159+
[is_power_of_two8]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU8.html#method.is_power_of_two
160+
[is_power_of_two16]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU16.html#method.is_power_of_two
161+
[is_power_of_two32]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU32.html#method.is_power_of_two
162+
[is_power_of_two64]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU64.html#method.is_power_of_two
163+
[is_power_of_two128]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU128.html#method.is_power_of_two
164+
[stdarch/1266]: https://github.com/rust-lang/stdarch/pull/1266
165+
1166
Version 1.58.1 (2022-01-19)
2167
===========================
3168

compiler/rustc_ast_lowering/src/asm.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
339339

340340
let idx2 = *o.get();
341341
let &(ref op2, op_sp2) = &operands[idx2];
342-
let reg2 = match op2.reg() {
343-
Some(asm::InlineAsmRegOrRegClass::Reg(r)) => r,
344-
_ => unreachable!(),
342+
let Some(asm::InlineAsmRegOrRegClass::Reg(reg2)) = op2.reg() else {
343+
unreachable!();
345344
};
346345

347346
let msg = format!(

compiler/rustc_ast_lowering/src/expr.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
330330
args: Vec<AstP<Expr>>,
331331
legacy_args_idx: &[usize],
332332
) -> hir::ExprKind<'hir> {
333-
let path = match f.kind {
334-
ExprKind::Path(None, ref mut path) => path,
335-
_ => unreachable!(),
333+
let ExprKind::Path(None, ref mut path) = f.kind else {
334+
unreachable!();
336335
};
337336

338337
// Split the arguments into const generics and normal arguments

compiler/rustc_ast_lowering/src/item.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1376,9 +1376,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
13761376
// keep track of the Span info. Now, `add_implicitly_sized` in `AstConv` checks both param bounds and
13771377
// where clauses for `?Sized`.
13781378
for pred in &generics.where_clause.predicates {
1379-
let bound_pred = match *pred {
1380-
WherePredicate::BoundPredicate(ref bound_pred) => bound_pred,
1381-
_ => continue,
1379+
let WherePredicate::BoundPredicate(ref bound_pred) = *pred else {
1380+
continue;
13821381
};
13831382
let compute_is_param = || {
13841383
// Check if the where clause type is a plain type parameter.

compiler/rustc_ast_passes/src/ast_validation.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,8 @@ impl<'a> AstValidator<'a> {
482482
}
483483

484484
fn check_foreign_kind_bodyless(&self, ident: Ident, kind: &str, body: Option<Span>) {
485-
let body = match body {
486-
None => return,
487-
Some(body) => body,
485+
let Some(body) = body else {
486+
return;
488487
};
489488
self.err_handler()
490489
.struct_span_err(ident.span, &format!("incorrect `{}` inside `extern` block", kind))
@@ -504,9 +503,8 @@ impl<'a> AstValidator<'a> {
504503

505504
/// An `fn` in `extern { ... }` cannot have a body `{ ... }`.
506505
fn check_foreign_fn_bodyless(&self, ident: Ident, body: Option<&Block>) {
507-
let body = match body {
508-
None => return,
509-
Some(body) => body,
506+
let Some(body) = body else {
507+
return;
510508
};
511509
self.err_handler()
512510
.struct_span_err(ident.span, "incorrect function inside `extern` block")

compiler/rustc_ast_passes/src/show_span.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ impl<'a> Visitor<'a> for ShowSpanVisitor<'a> {
5757
}
5858

5959
pub fn run(span_diagnostic: &rustc_errors::Handler, mode: &str, krate: &ast::Crate) {
60-
let mode = match mode.parse().ok() {
61-
Some(mode) => mode,
62-
None => return,
60+
let Ok(mode) = mode.parse() else {
61+
return;
6362
};
6463
let mut v = ShowSpanVisitor { span_diagnostic, mode };
6564
visit::walk_crate(&mut v, krate);

compiler/rustc_attr/src/builtin.rs

+10-14
Original file line numberDiff line numberDiff line change
@@ -556,17 +556,14 @@ pub fn eval_condition(
556556
return false;
557557
}
558558
};
559-
let min_version = match parse_version(min_version.as_str(), false) {
560-
Some(ver) => ver,
561-
None => {
562-
sess.span_diagnostic
563-
.struct_span_warn(
564-
*span,
565-
"unknown version literal format, assuming it refers to a future version",
566-
)
567-
.emit();
568-
return false;
569-
}
559+
let Some(min_version) = parse_version(min_version.as_str(), false) else {
560+
sess.span_diagnostic
561+
.struct_span_warn(
562+
*span,
563+
"unknown version literal format, assuming it refers to a future version",
564+
)
565+
.emit();
566+
return false;
570567
};
571568
let rustc_version = parse_version(env!("CFG_RELEASE"), true).unwrap();
572569

@@ -669,9 +666,8 @@ where
669666
break;
670667
}
671668

672-
let meta = match attr.meta() {
673-
Some(meta) => meta,
674-
None => continue,
669+
let Some(meta) = attr.meta() else {
670+
continue;
675671
};
676672
let mut since = None;
677673
let mut note = None;

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+8-19
Original file line numberDiff line numberDiff line change
@@ -2071,22 +2071,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
20712071
) = rvalue
20722072
{
20732073
for operand in operands {
2074-
let assigned_from = match operand {
2075-
Operand::Copy(assigned_from) | Operand::Move(assigned_from) => {
2076-
assigned_from
2077-
}
2078-
_ => continue,
2074+
let (Operand::Copy(assigned_from) | Operand::Move(assigned_from)) = operand else {
2075+
continue;
20792076
};
20802077
debug!(
20812078
"annotate_argument_and_return_for_borrow: assigned_from={:?}",
20822079
assigned_from
20832080
);
20842081

20852082
// Find the local from the operand.
2086-
let assigned_from_local = match assigned_from.local_or_deref_local()
2087-
{
2088-
Some(local) => local,
2089-
None => continue,
2083+
let Some(assigned_from_local) = assigned_from.local_or_deref_local() else {
2084+
continue;
20902085
};
20912086

20922087
if assigned_from_local != target {
@@ -2138,10 +2133,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
21382133
);
21392134

21402135
// Find the local from the rvalue.
2141-
let assigned_from_local = match assigned_from.local_or_deref_local() {
2142-
Some(local) => local,
2143-
None => continue,
2144-
};
2136+
let Some(assigned_from_local) = assigned_from.local_or_deref_local() else { continue };
21452137
debug!(
21462138
"annotate_argument_and_return_for_borrow: \
21472139
assigned_from_local={:?}",
@@ -2189,11 +2181,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
21892181
assigned_to, args
21902182
);
21912183
for operand in args {
2192-
let assigned_from = match operand {
2193-
Operand::Copy(assigned_from) | Operand::Move(assigned_from) => {
2194-
assigned_from
2195-
}
2196-
_ => continue,
2184+
let (Operand::Copy(assigned_from) | Operand::Move(assigned_from)) = operand else {
2185+
continue;
21972186
};
21982187
debug!(
21992188
"annotate_argument_and_return_for_borrow: assigned_from={:?}",
@@ -2309,7 +2298,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
23092298
// Closure arguments are wrapped in a tuple, so we need to get the first
23102299
// from that.
23112300
if let ty::Tuple(elems) = argument_ty.kind() {
2312-
let argument_ty = elems.first()?.expect_ty();
2301+
let &argument_ty = elems.first()?;
23132302
if let ty::Ref(_, _, _) = argument_ty.kind() {
23142303
return Some(AnnotatedBorrowFnSignature::Closure {
23152304
argument_ty,

0 commit comments

Comments
 (0)