Skip to content

Commit 1884438

Browse files
committed
Merge release 0.1.5 into master
2 parents 1675e9a + 9de1b2c commit 1884438

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "async-trait"
3-
version = "0.1.4"
3+
version = "0.1.5"
44
authors = ["David Tolnay <dtolnay@gmail.com>"]
55
edition = "2018"
66
license = "MIT OR Apache-2.0"
@@ -16,3 +16,10 @@ proc-macro = true
1616
proc-macro2 = "0.4"
1717
quote = "0.6"
1818
syn = { version = "0.15.41", features = ["full", "visit-mut"] }
19+
20+
[features]
21+
# Alternative implementation that produces worse error messages but potentially
22+
# works on old nightlies without https://github.com/rust-lang/rust/pull/61775 in
23+
# some cases where the default implementation does not. This feature is semver
24+
# exempt and might get removed without notice in any patch version.
25+
support_old_nightly = []

src/expand.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,15 @@ fn transform_block(
225225
has_self: bool,
226226
is_local: bool,
227227
) {
228+
if cfg!(feature = "support_old_nightly") {
229+
let brace = block.brace_token;
230+
*block = parse_quote!({
231+
core::pin::Pin::from(Box::new(async move #block))
232+
});
233+
block.brace_token = brace;
234+
return;
235+
}
236+
228237
let inner = Ident::new(&format!("__{}", sig.ident), sig.ident.span());
229238
let args = sig
230239
.decl

0 commit comments

Comments
 (0)