Skip to content

Commit

Permalink
Auto merge of rust-lang#124208 - jieyouxu:rollup-gbgpu4u, r=jieyouxu
Browse files Browse the repository at this point in the history
Rollup of 10 pull requests

Successful merges:

 - rust-lang#123379 (Print note with closure signature on type mismatch)
 - rust-lang#123967 (static_mut_refs: use raw pointers to remove the remaining FIXME)
 - rust-lang#123976 (Use fake libc in core test)
 - rust-lang#123986 (lint-docs: Add redirects for renamed lints.)
 - rust-lang#124053 (coverage: Branch coverage tests for lazy boolean operators)
 - rust-lang#124071 (Add llvm-bitcode-linker to build manifest)
 - rust-lang#124103 (Improve std::fs::Metadata Debug representation)
 - rust-lang#124132 (llvm RustWrapper: explain OpBundlesIndirect argument type)
 - rust-lang#124191 (Give a name to each distinct manipulation of pretty-printer FixupContext)
 - rust-lang#124196 (mir-opt tests: rename unit-test -> test-mir-pass)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Apr 20, 2024
2 parents dbce3b4 + c72cfdd commit 453ceaf
Show file tree
Hide file tree
Showing 184 changed files with 912 additions and 421 deletions.
25 changes: 6 additions & 19 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
//! Note that HIR pretty printing is layered on top of this crate.
mod expr;
mod fixup;
mod item;

use crate::pp::Breaks::{Consistent, Inconsistent};
use crate::pp::{self, Breaks};
use crate::pprust::state::expr::FixupContext;
use crate::pprust::state::fixup::FixupContext;
use ast::TraitBoundModifiers;
use rustc_ast::attr::AttrIdGenerator;
use rustc_ast::ptr::P;
use rustc_ast::token::{self, BinOpToken, CommentKind, Delimiter, Nonterminal, Token, TokenKind};
use rustc_ast::tokenstream::{Spacing, TokenStream, TokenTree};
use rustc_ast::util::classify;
use rustc_ast::util::comments::{Comment, CommentStyle};
use rustc_ast::util::parser;
use rustc_ast::{self as ast, AttrArgs, AttrArgsEq, BlockCheckMode, PatKind};
use rustc_ast::{attr, BindingMode, ByRef, DelimArgs, RangeEnd, RangeSyntax, Term};
use rustc_ast::{GenericArg, GenericBound, SelfKind};
Expand Down Expand Up @@ -1252,22 +1252,14 @@ impl<'a> State<'a> {
ast::StmtKind::Item(item) => self.print_item(item),
ast::StmtKind::Expr(expr) => {
self.space_if_not_bol();
self.print_expr_outer_attr_style(
expr,
false,
FixupContext { stmt: true, ..FixupContext::default() },
);
self.print_expr_outer_attr_style(expr, false, FixupContext::new_stmt());
if classify::expr_requires_semi_to_be_stmt(expr) {
self.word(";");
}
}
ast::StmtKind::Semi(expr) => {
self.space_if_not_bol();
self.print_expr_outer_attr_style(
expr,
false,
FixupContext { stmt: true, ..FixupContext::default() },
);
self.print_expr_outer_attr_style(expr, false, FixupContext::new_stmt());
self.word(";");
}
ast::StmtKind::Empty => {
Expand Down Expand Up @@ -1319,11 +1311,7 @@ impl<'a> State<'a> {
ast::StmtKind::Expr(expr) if i == blk.stmts.len() - 1 => {
self.maybe_print_comment(st.span.lo());
self.space_if_not_bol();
self.print_expr_outer_attr_style(
expr,
false,
FixupContext { stmt: true, ..FixupContext::default() },
);
self.print_expr_outer_attr_style(expr, false, FixupContext::new_stmt());
self.maybe_print_trailing_comment(expr.span, Some(blk.span.hi()));
}
_ => self.print_stmt(st),
Expand Down Expand Up @@ -1367,8 +1355,7 @@ impl<'a> State<'a> {
self.word_space("=");
self.print_expr_cond_paren(
expr,
fixup.parenthesize_exterior_struct_lit && parser::contains_exterior_struct_lit(expr)
|| parser::needs_par_as_let_scrutinee(expr.precedence().order()),
fixup.needs_par_as_let_scrutinee(expr),
FixupContext::default(),
);
}
Expand Down
Loading

0 comments on commit 453ceaf

Please sign in to comment.