Skip to content

Commit

Permalink
Fix most recenty nightly breakage due to removed await! support (#3722)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok authored and topecongiro committed Aug 2, 2019
1 parent 3b7a518 commit 62a32e7
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 68 deletions.
86 changes: 43 additions & 43 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ env_logger = "0.6"
getopts = "0.2"
derive-new = "0.5"
cargo_metadata = "0.8"
rustc-ap-rustc_target = "542.0.0"
rustc-ap-syntax = "542.0.0"
rustc-ap-syntax_pos = "542.0.0"
rustc-ap-rustc_target = "546.0.0"
rustc-ap-syntax = "546.0.0"
rustc-ap-syntax_pos = "546.0.0"
failure = "0.1.3"
bytecount = "0.5"
unicode-width = "0.1.5"
Expand Down
6 changes: 2 additions & 4 deletions src/chains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl ChainItemKind {
let span = mk_sp(nested.span.hi(), field.span.hi());
(kind, span)
}
ast::ExprKind::Await(ast::AwaitOrigin::FieldLike, ref nested) => {
ast::ExprKind::Await(ref nested) => {
let span = mk_sp(nested.span.hi(), expr.span.hi());
(ChainItemKind::Await, span)
}
Expand Down Expand Up @@ -396,9 +396,7 @@ impl Chain {
}
ast::ExprKind::Field(ref subexpr, _)
| ast::ExprKind::Try(ref subexpr)
| ast::ExprKind::Await(ast::AwaitOrigin::FieldLike, ref subexpr) => {
Some(Self::convert_try(subexpr, context))
}
| ast::ExprKind::Await(ref subexpr) => Some(Self::convert_try(subexpr, context)),
_ => None,
}
}
Expand Down
14 changes: 1 addition & 13 deletions src/expr.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::borrow::Cow;
use std::cmp::min;
use std::iter;

use itertools::Itertools;
use syntax::parse::token::DelimToken;
Expand Down Expand Up @@ -367,18 +366,7 @@ pub(crate) fn format_expr(
))
}
}
ast::ExprKind::Await(ast::AwaitOrigin::FieldLike, _) => rewrite_chain(expr, context, shape),
ast::ExprKind::Await(ast::AwaitOrigin::MacroLike, ref nested) => {
overflow::rewrite_with_parens(
context,
"await!",
iter::once(nested),
shape,
expr.span,
context.config.max_width(),
None,
)
}
ast::ExprKind::Await(_) => rewrite_chain(expr, context, shape),
ast::ExprKind::Err => None,
};

Expand Down
8 changes: 5 additions & 3 deletions tests/source/async_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ async unsafe fn rust() {
}
}

async fn await_macro() {
await ! (
something)?;
async fn await_try() {
something
.await
?
;
}
4 changes: 2 additions & 2 deletions tests/target/async_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ async unsafe fn rust() {
}
}

async fn await_macro() {
await!(something)?;
async fn await_try() {
something.await?;
}

0 comments on commit 62a32e7

Please sign in to comment.