Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8a73f50

Browse files
committedMar 11, 2023
Auto merge of #109019 - matthiaskrgr:rollup-ihjntil, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #104363 (Make `unused_allocation` lint against `Box::new` too) - #106633 (Stabilize `nonzero_min_max`) - #106844 (allow negative numeric literals in `concat!`) - #108071 (Implement goal caching with the new solver) - #108542 (Force parentheses around `match` expression in binary expression) - #108690 (Place size limits on query keys and values) - #108708 (Prevent overflow through Arc::downgrade) - #108739 (Prevent the `start_bx` basic block in codegen from having two `Builder`s at the same time) - #108806 (Querify register_tools and post-expansion early lints) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 67e1681 + df50001 commit 8a73f50

File tree

45 files changed

+445
-272
lines changed

Some content is hidden

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

45 files changed

+445
-272
lines changed
 

‎compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ fn compute_hir_hash(
436436
pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> hir::Crate<'_> {
437437
let sess = tcx.sess;
438438
tcx.ensure().output_filenames(());
439+
let _ = tcx.early_lint_checks(()); // Borrows `resolver_for_lowering`.
439440
let (mut resolver, krate) = tcx.resolver_for_lowering(()).steal();
440441

441442
let ast_index = index_crate(&resolver.node_id_to_def_id, &krate);

‎compiler/rustc_ast_pretty/src/pprust/state/expr.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ impl<'a> State<'a> {
244244
(&ast::ExprKind::Let { .. }, _) if !parser::needs_par_as_let_scrutinee(prec) => {
245245
parser::PREC_FORCE_PAREN
246246
}
247+
// For a binary expression like `(match () { _ => a }) OP b`, the parens are required
248+
// otherwise the parser would interpret `match () { _ => a }` as a statement,
249+
// with the remaining `OP b` not making sense. So we force parens.
250+
(&ast::ExprKind::Match(..), _) => parser::PREC_FORCE_PAREN,
247251
_ => left_prec,
248252
};
249253

0 commit comments

Comments
 (0)
Please sign in to comment.