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