Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
78 changes: 38 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,32 +107,32 @@ lazy_static = "1.0.0"

[dependencies.rustc_ast]
package = "rustc-ap-rustc_ast"
version = "677.0.0"
version = "678.0.0"

[dependencies.rustc_ast_pretty]
package = "rustc-ap-rustc_ast_pretty"
version = "677.0.0"
version = "678.0.0"

[dependencies.rustc_data_structures]
package = "rustc-ap-rustc_data_structures"
version = "677.0.0"
version = "678.0.0"

[dependencies.rustc_errors]
package = "rustc-ap-rustc_errors"
version = "677.0.0"
version = "678.0.0"

[dependencies.rustc_expand]
package = "rustc-ap-rustc_expand"
version = "677.0.0"
version = "678.0.0"

[dependencies.rustc_parse]
package = "rustc-ap-rustc_parse"
version = "677.0.0"
version = "678.0.0"

[dependencies.rustc_session]
package = "rustc-ap-rustc_session"
version = "677.0.0"
version = "678.0.0"

[dependencies.rustc_span]
package = "rustc-ap-rustc_span"
version = "677.0.0"
version = "678.0.0"
5 changes: 1 addition & 4 deletions src/formatting/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ pub(crate) fn get_span_without_attrs(stmt: &ast::Stmt) -> Span {
ast::StmtKind::Local(ref local) => local.span,
ast::StmtKind::Item(ref item) => item.span,
ast::StmtKind::Expr(ref expr) | ast::StmtKind::Semi(ref expr) => expr.span,
ast::StmtKind::MacCall(ref mac) => {
let (ref mac, _, _) = **mac;
mac.span()
}
ast::StmtKind::MacCall(ref mac_stmt) => mac_stmt.mac.span(),
ast::StmtKind::Empty => stmt.span,
}
}
Expand Down
9 changes: 4 additions & 5 deletions src/formatting/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1181,8 +1181,7 @@ fn next_space(tok: &TokenKind) -> SpaceState {
| TokenKind::Pound
| TokenKind::Dollar
| TokenKind::OpenDelim(_)
| TokenKind::CloseDelim(_)
| TokenKind::Whitespace => SpaceState::Never,
| TokenKind::CloseDelim(_) => SpaceState::Never,

TokenKind::Literal(..) | TokenKind::Ident(..) | TokenKind::Lifetime(_) => SpaceState::Ident,

Expand Down Expand Up @@ -1287,11 +1286,11 @@ impl MacroParser {
}
};
if let Some(TokenTree::Token(Token { kind, span })) = self.toks.look_ahead(0) {
if (is_macro_rules && kind == TokenKind::Semi)
|| (!is_macro_rules && kind == TokenKind::Comma)
if (is_macro_rules && *kind == TokenKind::Semi)
|| (!is_macro_rules && *kind == TokenKind::Comma)
{
self.toks.next();
hi = span.hi();
self.toks.next();
}
}
Some(MacroBranch {
Expand Down
7 changes: 3 additions & 4 deletions src/formatting/spanned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,11 @@ impl Spanned for ast::Stmt {
ast::StmtKind::Expr(ref expr) | ast::StmtKind::Semi(ref expr) => {
mk_sp(expr.span().lo(), self.span.hi())
}
ast::StmtKind::MacCall(ref mac) => {
let (_, _, ref attrs) = **mac;
if attrs.is_empty() {
ast::StmtKind::MacCall(ref mac_stmt) => {
if mac_stmt.attrs.is_empty() {
self.span
} else {
mk_sp(attrs[0].span.lo(), self.span.hi())
mk_sp(mac_stmt.attrs[0].span.lo(), self.span.hi())
}
}
ast::StmtKind::Empty => self.span,
Expand Down
13 changes: 5 additions & 8 deletions src/formatting/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,19 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
self.push_rewrite(stmt.span(), rewrite)
}
}
ast::StmtKind::MacCall(ref mac) => {
let (ref mac, _macro_style, ref attrs) = **mac;
if self.visit_attrs(attrs, ast::AttrStyle::Outer) {
ast::StmtKind::MacCall(ref mac_stmt) => {
if self.visit_attrs(&mac_stmt.attrs, ast::AttrStyle::Outer) {
self.push_skipped_with_span(
attrs,
&mac_stmt.attrs,
stmt.span(),
get_span_without_attrs(stmt.as_ast_node()),
);
} else {
self.visit_mac(mac, None, MacroPosition::Statement);
self.visit_mac(&mac_stmt.mac, None, MacroPosition::Statement);
}
self.format_missing(stmt.span().hi());
}
ast::StmtKind::Empty => {
// println!("inside visitor with empty statement");
}
ast::StmtKind::Empty => {}
}
}

Expand Down