File tree Expand file tree Collapse file tree 3 files changed +3
-7
lines changed
compiler/rustc_ast_lowering/src Expand file tree Collapse file tree 3 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -759,10 +759,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
759
759
match self . coroutine_kind {
760
760
Some ( hir:: CoroutineKind :: Async ( _) ) => { }
761
761
Some ( hir:: CoroutineKind :: Coroutine ) | Some ( hir:: CoroutineKind :: Gen ( _) ) | None => {
762
- self . tcx . sess . emit_err ( AwaitOnlyInAsyncFnAndBlocks {
762
+ return hir :: ExprKind :: Err ( self . tcx . sess . emit_err ( AwaitOnlyInAsyncFnAndBlocks {
763
763
await_kw_span,
764
764
item_span : self . current_item ,
765
- } ) ;
765
+ } ) ) ;
766
766
}
767
767
}
768
768
let span = self . mark_span_with_reason ( DesugaringKind :: Await , await_kw_span, None ) ;
@@ -1481,7 +1481,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1481
1481
match self . coroutine_kind {
1482
1482
Some ( hir:: CoroutineKind :: Gen ( _) ) => { }
1483
1483
Some ( hir:: CoroutineKind :: Async ( _) ) => {
1484
- self . tcx . sess . emit_err ( AsyncCoroutinesNotSupported { span } ) ;
1484
+ return hir :: ExprKind :: Err ( self . tcx . sess . emit_err ( AsyncCoroutinesNotSupported { span } ) ) ;
1485
1485
}
1486
1486
Some ( hir:: CoroutineKind :: Coroutine ) | None => {
1487
1487
if !self . tcx . features ( ) . coroutines {
Original file line number Diff line number Diff line change 3
3
async fn fun ( ) {
4
4
[ 1 ; ( ) . await ] ;
5
5
//~^ error: `await` is only allowed inside `async` functions and blocks
6
- //~| error: `.await` is not allowed in a `const`
7
- //~| error: `.await` is not allowed in a `const`
8
- //~| error: `()` is not a future
9
6
}
10
7
11
8
fn main ( ) { }
Original file line number Diff line number Diff line change @@ -11,5 +11,4 @@ fn main() {
11
11
//~^ ERROR `await` is only allowed inside `async` functions and blocks
12
12
( |_| 2333 ) . await ;
13
13
//~^ ERROR `await` is only allowed inside `async` functions and blocks
14
- //~| ERROR is not a future
15
14
}
You can’t perform that action at this time.
0 commit comments