@@ -40,13 +40,12 @@ use crate::errors::{
40
40
DoubleColonInBound , ExpectedIdentifier , ExpectedSemi , ExpectedSemiSugg ,
41
41
GenericParamsWithoutAngleBrackets , GenericParamsWithoutAngleBracketsSugg ,
42
42
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 ,
50
49
} ;
51
50
use crate :: parser:: attr:: InnerAttrPolicy ;
52
51
use crate :: { exp, fluent_generated as fluent} ;
@@ -1968,20 +1967,6 @@ impl<'a> Parser<'a> {
1968
1967
self . maybe_recover_from_bad_qpath ( expr)
1969
1968
}
1970
1969
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
-
1985
1970
fn recover_macro ( & mut self ) -> PResult < ' a , ( Span , P < Expr > , bool ) > {
1986
1971
self . expect ( exp ! ( Not ) ) ?;
1987
1972
self . expect ( exp ! ( OpenParen ) ) ?;
@@ -2033,25 +2018,6 @@ impl<'a> Parser<'a> {
2033
2018
( span, guar)
2034
2019
}
2035
2020
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
-
2055
2021
/// If encountering `future.await()`, consumes and emits an error.
2056
2022
pub ( super ) fn recover_from_await_method_call ( & mut self ) {
2057
2023
if self . token == token:: OpenDelim ( Delimiter :: Parenthesis )
0 commit comments