This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
compiler/rustc_builtin_macros/src Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -1237,15 +1237,17 @@ fn may_contain_yield_point(e: &ast::Expr) -> bool {
12371237
12381238 impl Visitor < ' _ > for MayContainYieldPoint {
12391239 fn visit_expr ( & mut self , e : & ast:: Expr ) {
1240- if let ast:: ExprKind :: Await ( _) | ast:: ExprKind :: Yield ( _) | ast:: ExprKind :: MacCall ( _) =
1241- e. kind
1242- {
1240+ if let ast:: ExprKind :: Await ( _) | ast:: ExprKind :: Yield ( _) = e. kind {
12431241 self . 0 = true ;
12441242 } else {
12451243 visit:: walk_expr ( self , e) ;
12461244 }
12471245 }
12481246
1247+ fn visit_mac_call ( & mut self , _: & ast:: MacCall ) {
1248+ self . 0 = true ;
1249+ }
1250+
12491251 fn visit_attribute ( & mut self , _: & ast:: Attribute ) {
12501252 // Conservatively assume this may be a proc macro attribute in
12511253 // expression position.
Original file line number Diff line number Diff line change @@ -11,13 +11,23 @@ async fn with_await() {
1111 println ! ( "{} {:?}" , "" , async { } . await ) ;
1212}
1313
14- async fn with_macro_call ( ) {
14+ async fn with_macro_call_expr ( ) {
1515 println ! ( "{} {:?}" , "" , m!( ) ) ;
1616}
1717
18+ async fn with_macro_call_stmt_semi ( ) {
19+ println ! ( "{} {:?}" , "" , { m!( ) ; } ) ;
20+ }
21+
22+ async fn with_macro_call_stmt_braced ( ) {
23+ println ! ( "{} {:?}" , "" , { m!{ } } ) ;
24+ }
25+
1826fn assert_send ( _: impl Send ) { }
1927
2028fn main ( ) {
2129 assert_send ( with_await ( ) ) ;
22- assert_send ( with_macro_call ( ) ) ;
30+ assert_send ( with_macro_call_expr ( ) ) ;
31+ assert_send ( with_macro_call_stmt_semi ( ) ) ;
32+ assert_send ( with_macro_call_stmt_braced ( ) ) ;
2333}
You can’t perform that action at this time.
0 commit comments