File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -350,6 +350,9 @@ fn transform_block(sig: &mut Signature, block: &mut Block) {
350350 let _: ( ) = { #( #decls) * #( #stmts) * } ;
351351 } ,
352352 ReturnType :: Type ( _, ret) => quote_spanned ! { block. brace_token. span=>
353+ if let :: core:: option:: Option :: Some ( __ret) = :: core:: option:: Option :: None :: <#ret> {
354+ return __ret;
355+ }
353356 let __ret: #ret = { #( #decls) * #( #stmts) * } ;
354357 #[ allow( unreachable_code) ]
355358 __ret
Original file line number Diff line number Diff line change @@ -1258,3 +1258,23 @@ pub mod issue147 {
12581258 }
12591259 }
12601260}
1261+
1262+ // https://github.com/dtolnay/async-trait/issues/149
1263+ pub mod issue149 {
1264+ use async_trait:: async_trait;
1265+
1266+ pub struct Thing ;
1267+ pub trait Ret { }
1268+ impl Ret for Thing { }
1269+
1270+ pub async fn ok ( ) -> & ' static dyn Ret {
1271+ return & Thing ;
1272+ }
1273+
1274+ #[ async_trait]
1275+ pub trait Trait {
1276+ async fn fail ( ) -> & ' static dyn Ret {
1277+ return & Thing ;
1278+ }
1279+ }
1280+ }
You can’t perform that action at this time.
0 commit comments