Skip to content

Commit cc2afec

Browse files
committed
Fix compile errors from breaking changes
1 parent dd3e1d7 commit cc2afec

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

src/closures.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use utils::{last_line_width, left_most_sub_expr, stmt_expr};
3131
// statement without needing a semi-colon), then adding or removing braces
3232
// can change whether it is treated as an expression or statement.
3333

34+
// FIXME(topecongiro) Format async closures (#2813).
3435
pub fn rewrite_closure(
3536
capture: ast::CaptureBy,
3637
movability: ast::Movability,
@@ -288,7 +289,7 @@ pub fn rewrite_last_closure(
288289
expr: &ast::Expr,
289290
shape: Shape,
290291
) -> Option<String> {
291-
if let ast::ExprKind::Closure(capture, movability, ref fn_decl, ref body, _) = expr.node {
292+
if let ast::ExprKind::Closure(capture, _, movability, ref fn_decl, ref body, _) = expr.node {
292293
let body = match body.node {
293294
ast::ExprKind::Block(ref block, _)
294295
if !is_unsafe_block(block)

src/expr.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ pub fn format_expr(
183183
} else {
184184
Some("yield".to_string())
185185
},
186-
ast::ExprKind::Closure(capture, movability, ref fn_decl, ref body, _) => {
186+
ast::ExprKind::Closure(capture, _, movability, ref fn_decl, ref body, _) => {
187187
closures::rewrite_closure(
188188
capture, movability, fn_decl, body, expr.span, context, shape,
189189
)
@@ -344,6 +344,8 @@ pub fn format_expr(
344344
}
345345
// FIXME(#2743)
346346
ast::ExprKind::ObsoleteInPlace(..) => unimplemented!(),
347+
// FIXME(topecongiro) Format async block.
348+
ast::ExprKind::Async(..) => None,
347349
};
348350

349351
expr_rw

src/items.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ impl<'a> FnSig<'a> {
192192
generics: &'a ast::Generics,
193193
) -> FnSig<'a> {
194194
FnSig {
195-
unsafety: method_sig.unsafety,
196-
constness: method_sig.constness.node,
195+
unsafety: method_sig.header.unsafety,
196+
constness: method_sig.header.constness.node,
197197
defaultness: ast::Defaultness::Final,
198-
abi: method_sig.abi,
198+
abi: method_sig.header.abi,
199199
decl: &*method_sig.decl,
200200
generics,
201201
visibility: DEFAULT_VISIBILITY,
@@ -209,13 +209,13 @@ impl<'a> FnSig<'a> {
209209
defaultness: ast::Defaultness,
210210
) -> FnSig<'a> {
211211
match *fn_kind {
212-
visit::FnKind::ItemFn(_, unsafety, constness, abi, visibility, _) => FnSig {
212+
visit::FnKind::ItemFn(_, fn_header, visibility, _) => FnSig {
213213
decl,
214214
generics,
215-
abi,
216-
constness: constness.node,
215+
abi: fn_header.abi,
216+
constness: fn_header.constness.node,
217217
defaultness,
218-
unsafety,
218+
unsafety: fn_header.unsafety,
219219
visibility: visibility.clone(),
220220
},
221221
visit::FnKind::Method(_, method_sig, vis, _) => {

src/visitor.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
252252

253253
// Note that this only gets called for function definitions. Required methods
254254
// on traits do not get handled here.
255+
// FIXME(topecongiro) Format async fn (#2812).
255256
fn visit_fn(
256257
&mut self,
257258
fk: visit::FnKind,
@@ -264,7 +265,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
264265
let indent = self.block_indent;
265266
let block;
266267
let rewrite = match fk {
267-
visit::FnKind::ItemFn(ident, _, _, _, _, b) | visit::FnKind::Method(ident, _, _, b) => {
268+
visit::FnKind::ItemFn(ident, _, _, b) | visit::FnKind::Method(ident, _, _, b) => {
268269
block = b;
269270
self.rewrite_fn(
270271
indent,
@@ -392,10 +393,10 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
392393
ast::ItemKind::Static(..) | ast::ItemKind::Const(..) => {
393394
self.visit_static(&StaticParts::from_item(item));
394395
}
395-
ast::ItemKind::Fn(ref decl, unsafety, constness, abi, ref generics, ref body) => {
396+
ast::ItemKind::Fn(ref decl, fn_header, ref generics, ref body) => {
396397
let inner_attrs = inner_attributes(&item.attrs);
397398
self.visit_fn(
398-
visit::FnKind::ItemFn(item.ident, unsafety, constness, abi, &item.vis, body),
399+
visit::FnKind::ItemFn(item.ident, fn_header, &item.vis, body),
399400
generics,
400401
decl,
401402
item.span,

0 commit comments

Comments
 (0)