File tree Expand file tree Collapse file tree 3 files changed +53
-0
lines changed Expand file tree Collapse file tree 3 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualAsyncFn {
62
62
&& let Some ( closure_body) = desugared_async_block ( cx, block)
63
63
&& let Node :: Item ( Item { vis_span, ..} ) | Node :: ImplItem ( ImplItem { vis_span, ..} ) =
64
64
cx. tcx . hir_node_by_def_id ( fn_def_id)
65
+ && !span. from_expansion ( )
65
66
{
66
67
let header_span = span. with_hi ( ret_ty. span . hi ( ) ) ;
67
68
Original file line number Diff line number Diff line change @@ -113,4 +113,30 @@ pub(crate) async fn issue_10450_2() -> i32 { 42 }
113
113
114
114
pub(self) async fn issue_10450_3() -> i32 { 42 }
115
115
116
+ macro_rules! issue_12407 {
117
+ (
118
+ $(
119
+ $(#[$m:meta])*
120
+ $v:vis $(override($($overrides:tt),* $(,)?))? fn $name:ident $([$($params:tt)*])? (
121
+ $($arg_name:ident: $arg_typ:ty),* $(,)?
122
+ ) $(-> $ret_ty:ty)? = $e:expr;
123
+ )*
124
+ ) => {
125
+ $(
126
+ $(#[$m])*
127
+ $v $($($overrides)*)? fn $name$(<$($params)*>)?(
128
+ $($arg_name: $arg_typ),*
129
+ ) $(-> $ret_ty)? {
130
+ $e
131
+ }
132
+ )*
133
+ };
134
+ }
135
+
136
+ issue_12407! {
137
+ fn _hello() -> impl Future<Output = ()> = async {};
138
+ fn non_async() = println!("hello");
139
+ fn foo() = non_async();
140
+ }
141
+
116
142
fn main() {}
Original file line number Diff line number Diff line change @@ -139,4 +139,30 @@ pub(self) fn issue_10450_3() -> impl Future<Output = i32> {
139
139
async { 42 }
140
140
}
141
141
142
+ macro_rules! issue_12407 {
143
+ (
144
+ $(
145
+ $( #[ $m: meta] ) *
146
+ $v: vis $( override( $( $overrides: tt) ,* $( , ) ?) ) ? fn $name: ident $( [ $( $params: tt) * ] ) ? (
147
+ $( $arg_name: ident: $arg_typ: ty) ,* $( , ) ?
148
+ ) $( -> $ret_ty: ty) ? = $e: expr;
149
+ ) *
150
+ ) => {
151
+ $(
152
+ $( #[ $m] ) *
153
+ $v $( $( $overrides) * ) ? fn $name$( <$( $params) * >) ?(
154
+ $( $arg_name: $arg_typ) ,*
155
+ ) $( -> $ret_ty) ? {
156
+ $e
157
+ }
158
+ ) *
159
+ } ;
160
+ }
161
+
162
+ issue_12407 ! {
163
+ fn _hello( ) -> impl Future <Output = ( ) > = async { } ;
164
+ fn non_async( ) = println!( "hello" ) ;
165
+ fn foo( ) = non_async( ) ;
166
+ }
167
+
142
168
fn main ( ) { }
You can’t perform that action at this time.
0 commit comments