@@ -31,11 +31,11 @@ use super::{
3131 SeqSep , TokenType ,
3232} ;
3333use 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 ,
3939 GenericParamsWithoutAngleBrackets , GenericParamsWithoutAngleBracketsSugg ,
4040 HelpIdentifierStartsWithNumber , HelpUseLatestEdition , InInTypo , IncorrectAwait ,
4141 IncorrectSemicolon , IncorrectUseOfAwait , IncorrectUseOfUse , PatternMethodParamWithoutBody ,
@@ -572,10 +572,17 @@ impl<'a> Parser<'a> {
572572 return Err ( self . dcx ( ) . create_err ( UseEqInstead { span : self . token . span } ) ) ;
573573 }
574574
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.
577579 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+ }
579586 }
580587
581588 let expect = tokens_to_string ( & expected) ;
0 commit comments