Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #94167

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c05276a
Stabilize pin_static_ref.
m-ou-se Feb 2, 2022
1ab5b0b
removing architecture requirements for RustyHermit
stlankes Feb 15, 2022
227d106
remove compiler warnings
stlankes Feb 15, 2022
4b5beae
adapt static-nobundle test to use llvm-nm
krasimirgg Feb 15, 2022
0647e38
add llvm-nm to bootstrap dist bin's
krasimirgg Feb 16, 2022
5cf8274
Add module-level docs for `rustc_middle::query`
pierwill Feb 17, 2022
f7448a7
core: Implement trim functions on byte slices
dbrgn Feb 6, 2022
0f14bea
Optimize char_try_from_u32
digama0 Feb 18, 2022
7c3ebec
fix
digama0 Feb 18, 2022
b78123c
Fix miniz_oxide types showing up in std
GuillaumeGomez Feb 18, 2022
f2a404d
Convert `newtype_index` to a proc macro
Aaron1011 Feb 9, 2022
db0b3bd
Fix test
Aaron1011 Feb 18, 2022
cb2e4ee
Address review comments
Aaron1011 Feb 19, 2022
c2da477
Fix pretty printing of enums without variants
tmiasko Feb 17, 2022
2ef8af6
Adopt let else in more places
est31 Feb 18, 2022
7ff21ed
Rollup merge of #93580 - m-ou-se:stabilize-pin-static-ref, r=scottmcm
matthiaskrgr Feb 19, 2022
8cf339c
Rollup merge of #93686 - dbrgn:trim-on-byte-slices, r=joshtriplett
matthiaskrgr Feb 19, 2022
e8c3f35
Rollup merge of #93878 - Aaron1011:newtype-macro, r=cjgillot
matthiaskrgr Feb 19, 2022
ba625c5
Rollup merge of #94019 - hermitcore:target, r=Mark-Simulacrum
matthiaskrgr Feb 19, 2022
803a255
Rollup merge of #94023 - krasimirgg:head-llvm-use-llvm-nm, r=Mark-Sim…
matthiaskrgr Feb 19, 2022
7d5a3a3
Rollup merge of #94093 - tmiasko:pp-no-variants, r=oli-obk
matthiaskrgr Feb 19, 2022
455f0d4
Rollup merge of #94097 - pierwill:doc-rustc-middle-query, r=cjgillot
matthiaskrgr Feb 19, 2022
c7de631
Rollup merge of #94112 - digama0:patch-3, r=scottmcm
matthiaskrgr Feb 19, 2022
ee373d2
Rollup merge of #94122 - GuillaumeGomez:miniz-oxide-std, r=notriddle
matthiaskrgr Feb 19, 2022
7f7f44b
Rollup merge of #94146 - est31:let_else, r=cjgillot
matthiaskrgr Feb 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"hermit-abi 0.1.19",
"libc",
"winapi",
]
Expand Down Expand Up @@ -1610,6 +1610,15 @@ name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]

[[package]]
name = "hermit-abi"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ab7905ea95c6d9af62940f9d7dd9596d54c334ae2c15300c482051292d5637f"
dependencies = [
"compiler_builtins",
"libc",
Expand Down Expand Up @@ -2396,7 +2405,7 @@ version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
dependencies = [
"hermit-abi",
"hermit-abi 0.1.19",
"libc",
]

Expand Down Expand Up @@ -4782,7 +4791,7 @@ dependencies = [
"dlmalloc",
"fortanix-sgx-abi",
"hashbrown 0.12.0",
"hermit-abi",
"hermit-abi 0.2.0",
"libc",
"miniz_oxide",
"object 0.26.2",
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_ast_lowering/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {

let idx2 = *o.get();
let &(ref op2, op_sp2) = &operands[idx2];
let reg2 = match op2.reg() {
Some(asm::InlineAsmRegOrRegClass::Reg(r)) => r,
_ => unreachable!(),
let Some(asm::InlineAsmRegOrRegClass::Reg(reg2)) = op2.reg() else {
unreachable!();
};

let msg = format!(
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
args: Vec<AstP<Expr>>,
legacy_args_idx: &[usize],
) -> hir::ExprKind<'hir> {
let path = match f.kind {
ExprKind::Path(None, ref mut path) => path,
_ => unreachable!(),
let ExprKind::Path(None, ref mut path) = f.kind else {
unreachable!();
};

// Split the arguments into const generics and normal arguments
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1376,9 +1376,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
// keep track of the Span info. Now, `add_implicitly_sized` in `AstConv` checks both param bounds and
// where clauses for `?Sized`.
for pred in &generics.where_clause.predicates {
let bound_pred = match *pred {
WherePredicate::BoundPredicate(ref bound_pred) => bound_pred,
_ => continue,
let WherePredicate::BoundPredicate(ref bound_pred) = *pred else {
continue;
};
let compute_is_param = || {
// Check if the where clause type is a plain type parameter.
Expand Down
10 changes: 4 additions & 6 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,8 @@ impl<'a> AstValidator<'a> {
}

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

/// An `fn` in `extern { ... }` cannot have a body `{ ... }`.
fn check_foreign_fn_bodyless(&self, ident: Ident, body: Option<&Block>) {
let body = match body {
None => return,
Some(body) => body,
let Some(body) = body else {
return;
};
self.err_handler()
.struct_span_err(ident.span, "incorrect function inside `extern` block")
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_ast_passes/src/show_span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ impl<'a> Visitor<'a> for ShowSpanVisitor<'a> {
}

pub fn run(span_diagnostic: &rustc_errors::Handler, mode: &str, krate: &ast::Crate) {
let mode = match mode.parse().ok() {
Some(mode) => mode,
None => return,
let Ok(mode) = mode.parse() else {
return;
};
let mut v = ShowSpanVisitor { span_diagnostic, mode };
visit::walk_crate(&mut v, krate);
Expand Down
24 changes: 10 additions & 14 deletions compiler/rustc_attr/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,17 +556,14 @@ pub fn eval_condition(
return false;
}
};
let min_version = match parse_version(min_version.as_str(), false) {
Some(ver) => ver,
None => {
sess.span_diagnostic
.struct_span_warn(
*span,
"unknown version literal format, assuming it refers to a future version",
)
.emit();
return false;
}
let Some(min_version) = parse_version(min_version.as_str(), false) else {
sess.span_diagnostic
.struct_span_warn(
*span,
"unknown version literal format, assuming it refers to a future version",
)
.emit();
return false;
};
let rustc_version = parse_version(env!("CFG_RELEASE"), true).unwrap();

Expand Down Expand Up @@ -669,9 +666,8 @@ where
break;
}

let meta = match attr.meta() {
Some(meta) => meta,
None => continue,
let Some(meta) = attr.meta() else {
continue;
};
let mut since = None;
let mut note = None;
Expand Down
25 changes: 7 additions & 18 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2071,22 +2071,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
) = rvalue
{
for operand in operands {
let assigned_from = match operand {
Operand::Copy(assigned_from) | Operand::Move(assigned_from) => {
assigned_from
}
_ => continue,
let (Operand::Copy(assigned_from) | Operand::Move(assigned_from)) = operand else {
continue;
};
debug!(
"annotate_argument_and_return_for_borrow: assigned_from={:?}",
assigned_from
);

// Find the local from the operand.
let assigned_from_local = match assigned_from.local_or_deref_local()
{
Some(local) => local,
None => continue,
let Some(assigned_from_local) = assigned_from.local_or_deref_local() else {
continue;
};

if assigned_from_local != target {
Expand Down Expand Up @@ -2138,10 +2133,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
);

// Find the local from the rvalue.
let assigned_from_local = match assigned_from.local_or_deref_local() {
Some(local) => local,
None => continue,
};
let Some(assigned_from_local) = assigned_from.local_or_deref_local() else { continue };
debug!(
"annotate_argument_and_return_for_borrow: \
assigned_from_local={:?}",
Expand Down Expand Up @@ -2189,11 +2181,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
assigned_to, args
);
for operand in args {
let assigned_from = match operand {
Operand::Copy(assigned_from) | Operand::Move(assigned_from) => {
assigned_from
}
_ => continue,
let (Operand::Copy(assigned_from) | Operand::Move(assigned_from)) = operand else {
continue;
};
debug!(
"annotate_argument_and_return_for_borrow: assigned_from={:?}",
Expand Down
11 changes: 4 additions & 7 deletions compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,13 +650,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {

// The only kind of statement that we care about is assignments...
if let StatementKind::Assign(box (place, rvalue)) = &stmt.kind {
let into = match place.local_or_deref_local() {
Some(into) => into,
None => {
// Continue at the next location.
queue.push(current_location.successor_within_block());
continue;
}
let Some(into) = place.local_or_deref_local() else {
// Continue at the next location.
queue.push(current_location.successor_within_block());
continue;
};

match rvalue {
Expand Down
10 changes: 3 additions & 7 deletions compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
debug!("borrowed_content_source: init={:?}", init);
// We're only interested in statements that initialized a value, not the
// initializations from arguments.
let loc = match init.location {
InitLocation::Statement(stmt) => stmt,
_ => continue,
};
let InitLocation::Statement(loc) = init.location else { continue };

let bbd = &self.body[loc.block];
let is_terminator = bbd.statements.len() == loc.statement_index;
Expand Down Expand Up @@ -787,9 +784,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
) -> UseSpans<'tcx> {
use self::UseSpans::*;

let stmt = match self.body[location.block].statements.get(location.statement_index) {
Some(stmt) => stmt,
None => return OtherUse(self.body.source_info(location).span),
let Some(stmt) = self.body[location.block].statements.get(location.statement_index) else {
return OtherUse(self.body.source_info(location).span);
};

debug!("move_spans: moved_place={:?} location={:?} stmt={:?}", moved_place, location, stmt);
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_borrowck/src/diagnostics/move_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,9 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
}
// Error with the pattern
LookupResult::Exact(_) => {
let mpi = match self.move_data.rev_lookup.find(move_from.as_ref()) {
LookupResult::Parent(Some(mpi)) => mpi,
let LookupResult::Parent(Some(mpi)) = self.move_data.rev_lookup.find(move_from.as_ref()) else {
// move_from should be a projection from match_place.
_ => unreachable!("Probably not unreachable..."),
unreachable!("Probably not unreachable...");
};
for ge in &mut *grouped_errors {
if let GroupedMoveError::MovesFromValue {
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1914,10 +1914,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
// without going over a Deref.
let mut shortest_uninit_seen = None;
for prefix in this.prefixes(base, PrefixSet::Shallow) {
let mpi = match this.move_path_for_place(prefix) {
Some(mpi) => mpi,
None => continue,
};
let Some(mpi) = this.move_path_for_place(prefix) else { continue };

if maybe_uninits.contains(mpi) {
debug!(
Expand Down
12 changes: 5 additions & 7 deletions compiler/rustc_borrowck/src/region_infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,9 +913,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
let TypeTest { generic_kind, lower_bound, locations, verify_bound: _ } = type_test;

let generic_ty = generic_kind.to_ty(tcx);
let subject = match self.try_promote_type_test_subject(infcx, generic_ty) {
Some(s) => s,
None => return false,
let Some(subject) = self.try_promote_type_test_subject(infcx, generic_ty) else {
return false;
};

// For each region outlived by lower_bound find a non-local,
Expand Down Expand Up @@ -1623,15 +1622,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
// If we have some bound universal region `'a`, then the only
// elements it can contain is itself -- we don't know anything
// else about it!
let error_element = match {
let Some(error_element) = ({
self.scc_values.elements_contained_in(longer_fr_scc).find(|element| match element {
RegionElement::Location(_) => true,
RegionElement::RootUniversalRegion(_) => true,
RegionElement::PlaceholderRegion(placeholder1) => placeholder != *placeholder1,
})
} {
Some(v) => v,
None => return,
}) else {
return;
};
debug!("check_bound_universal_region: error_element = {:?}", error_element);

Expand Down
Loading