@@ -31,11 +31,11 @@ use super::{
31
31
SeqSep , TokenType ,
32
32
} ;
33
33
use crate :: errors:: {
34
- AddParen , AmbiguousPlus , AsyncMoveBlockIn2015 , AttributeOnParamType , AwaitSuggestion ,
35
- BadQPathStage2 , BadTypePlus , BadTypePlusSub , ColonAsSemi , ComparisonOperatorsCannotBeChained ,
36
- ComparisonOperatorsCannotBeChainedSugg , ConstGenericWithoutBraces ,
37
- ConstGenericWithoutBracesSugg , DocCommentDoesNotDocumentAnything , DocCommentOnParamType ,
38
- DoubleColonInBound , ExpectedIdentifier , ExpectedSemi , ExpectedSemiSugg ,
34
+ AddParen , AmbiguousPlus , AsyncMoveBlockIn2015 , AsyncUseBlockIn2015 , AttributeOnParamType ,
35
+ AwaitSuggestion , BadQPathStage2 , BadTypePlus , BadTypePlusSub , ColonAsSemi ,
36
+ ComparisonOperatorsCannotBeChained , ComparisonOperatorsCannotBeChainedSugg ,
37
+ ConstGenericWithoutBraces , ConstGenericWithoutBracesSugg , DocCommentDoesNotDocumentAnything ,
38
+ DocCommentOnParamType , DoubleColonInBound , ExpectedIdentifier , ExpectedSemi , ExpectedSemiSugg ,
39
39
GenericParamsWithoutAngleBrackets , GenericParamsWithoutAngleBracketsSugg ,
40
40
HelpIdentifierStartsWithNumber , HelpUseLatestEdition , InInTypo , IncorrectAwait ,
41
41
IncorrectSemicolon , IncorrectUseOfAwait , IncorrectUseOfUse , PatternMethodParamWithoutBody ,
@@ -572,10 +572,17 @@ impl<'a> Parser<'a> {
572
572
return Err ( self . dcx ( ) . create_err ( UseEqInstead { span : self . token . span } ) ) ;
573
573
}
574
574
575
- if self . token . is_keyword ( kw:: Move ) && self . prev_token . is_keyword ( kw:: Async ) {
576
- // The 2015 edition is in use because parsing of `async move` has failed.
575
+ if ( self . token . is_keyword ( kw:: Move ) || self . token . is_keyword ( kw:: Use ) )
576
+ && self . prev_token . is_keyword ( kw:: Async )
577
+ {
578
+ // The 2015 edition is in use because parsing of `async move` or `async use` has failed.
577
579
let span = self . prev_token . span . to ( self . token . span ) ;
578
- return Err ( self . dcx ( ) . create_err ( AsyncMoveBlockIn2015 { span } ) ) ;
580
+ if self . token . is_keyword ( kw:: Move ) {
581
+ return Err ( self . dcx ( ) . create_err ( AsyncMoveBlockIn2015 { span } ) ) ;
582
+ } else {
583
+ // kw::Use
584
+ return Err ( self . dcx ( ) . create_err ( AsyncUseBlockIn2015 { span } ) ) ;
585
+ }
579
586
}
580
587
581
588
let expect = tokens_to_string ( & expected) ;
0 commit comments