diff options
| author | xizheyin <xizheyin@smail.nju.edu.cn> | 2025-08-14 21:30:52 +0800 | 
|---|---|---|
| committer | xizheyin <xizheyin@smail.nju.edu.cn> | 2025-08-14 21:31:47 +0800 | 
| commit | 3ce555f6313e78d3eed80fd22e22ef49f5bd3611 (patch) | |
| tree | 627318589a851dd39a645753cd2ec425a7e4663b /compiler/rustc_parse/src/parser/path.rs | |
| parent | f5bc29568c39b6791f6d639d9a5ce065f7d4d889 (diff) | |
| download | rust-3ce555f6313e78d3eed80fd22e22ef49f5bd3611.tar.gz rust-3ce555f6313e78d3eed80fd22e22ef49f5bd3611.zip | |
Add FnContext in parser for diagnostic
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
Diffstat (limited to 'compiler/rustc_parse/src/parser/path.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/path.rs | 12 | 
1 files changed, 10 insertions, 2 deletions
| diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index a6ec3ea4245..37fc723cd89 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -20,7 +20,9 @@ use crate::errors::{ PathFoundAttributeInParams, PathFoundCVariadicParams, PathSingleColon, PathTripleColon, }; use crate::exp; -use crate::parser::{CommaRecoveryMode, ExprKind, RecoverColon, RecoverComma}; +use crate::parser::{ + CommaRecoveryMode, ExprKind, FnContext, FnParseMode, RecoverColon, RecoverComma, +}; /// Specifies how to parse a path. #[derive(Copy, Clone, PartialEq)] @@ -399,7 +401,13 @@ impl<'a> Parser<'a> { let dcx = self.dcx(); let parse_params_result = self.parse_paren_comma_seq(|p| { - let param = p.parse_param_general(|_| false, false, false); + // Inside parenthesized type arguments, we want types only, not names. + let mode = FnParseMode { + context: FnContext::Free, + req_name: |_| false, + req_body: false, + }; + let param = p.parse_param_general(&mode, false, false); param.map(move |param| { if !matches!(param.pat.kind, PatKind::Missing) { dcx.emit_err(FnPathFoundNamedParams { | 
