@@ -40,13 +40,12 @@ use crate::errors::{
4040 DoubleColonInBound , ExpectedIdentifier , ExpectedSemi , ExpectedSemiSugg ,
4141 GenericParamsWithoutAngleBrackets , GenericParamsWithoutAngleBracketsSugg ,
4242 HelpIdentifierStartsWithNumber , HelpUseLatestEdition , InInTypo , IncorrectAwait ,
43- IncorrectSemicolon , IncorrectUse , IncorrectUseOfAwait , IncorrectUseOfUse ,
44- PatternMethodParamWithoutBody , QuestionMarkInType , QuestionMarkInTypeSugg , SelfParamNotFirst ,
45- StructLiteralBodyWithoutPath , StructLiteralBodyWithoutPathSugg , StructLiteralNeedingParens ,
46- StructLiteralNeedingParensSugg , SuggAddMissingLetStmt , SuggEscapeIdentifier , SuggRemoveComma ,
47- TernaryOperator , UnexpectedConstInGenericParam , UnexpectedConstParamDeclaration ,
48- UnexpectedConstParamDeclarationSugg , UnmatchedAngleBrackets , UseEqInstead , UseSuggestion ,
49- WrapType ,
43+ IncorrectSemicolon , IncorrectUseOfAwait , IncorrectUseOfUse , PatternMethodParamWithoutBody ,
44+ QuestionMarkInType , QuestionMarkInTypeSugg , SelfParamNotFirst , StructLiteralBodyWithoutPath ,
45+ StructLiteralBodyWithoutPathSugg , StructLiteralNeedingParens , StructLiteralNeedingParensSugg ,
46+ SuggAddMissingLetStmt , SuggEscapeIdentifier , SuggRemoveComma , TernaryOperator ,
47+ UnexpectedConstInGenericParam , UnexpectedConstParamDeclaration ,
48+ UnexpectedConstParamDeclarationSugg , UnmatchedAngleBrackets , UseEqInstead , WrapType ,
5049} ;
5150use crate :: parser:: attr:: InnerAttrPolicy ;
5251use crate :: { exp, fluent_generated as fluent} ;
@@ -1968,20 +1967,6 @@ impl<'a> Parser<'a> {
19681967 self . maybe_recover_from_bad_qpath ( expr)
19691968 }
19701969
1971- /// Consumes alternative use syntaxes like `use!(<expr>)`, `use <expr>`,
1972- /// `use? <expr>`, `use(<expr>)`, and `use { <expr> }`.
1973- pub ( super ) fn recover_incorrect_use_syntax ( & mut self , use_sp : Span ) -> PResult < ' a , P < Expr > > {
1974- let ( hi, expr, is_question) = if self . token == token:: Not {
1975- // Handle `use!(<expr>)`.
1976- self . recover_macro ( ) ?
1977- } else {
1978- self . recover_prefix ( use_sp, "use" ) ?
1979- } ;
1980- let ( sp, guar) = self . error_on_incorrect_use ( use_sp, hi, & expr, is_question) ;
1981- let expr = self . mk_expr_err ( use_sp. to ( sp) , guar) ;
1982- self . maybe_recover_from_bad_qpath ( expr)
1983- }
1984-
19851970 fn recover_macro ( & mut self ) -> PResult < ' a , ( Span , P < Expr > , bool ) > {
19861971 self . expect ( exp ! ( Not ) ) ?;
19871972 self . expect ( exp ! ( OpenParen ) ) ?;
@@ -2033,25 +2018,6 @@ impl<'a> Parser<'a> {
20332018 ( span, guar)
20342019 }
20352020
2036- fn error_on_incorrect_use (
2037- & self ,
2038- lo : Span ,
2039- hi : Span ,
2040- expr : & Expr ,
2041- is_question : bool ,
2042- ) -> ( Span , ErrorGuaranteed ) {
2043- let span = lo. to ( hi) ;
2044- let guar = self . dcx ( ) . emit_err ( IncorrectUse {
2045- span,
2046- suggestion : UseSuggestion {
2047- removal : lo. until ( expr. span ) ,
2048- dot_use : expr. span . shrink_to_hi ( ) ,
2049- question_mark : if is_question { "?" } else { "" } ,
2050- } ,
2051- } ) ;
2052- ( span, guar)
2053- }
2054-
20552021 /// If encountering `future.await()`, consumes and emits an error.
20562022 pub ( super ) fn recover_from_await_method_call ( & mut self ) {
20572023 if self . token == token:: OpenDelim ( Delimiter :: Parenthesis )
0 commit comments