Skip to content

Commit bafc9b3

Browse files
Rollup merge of #160040 - kpreid:parse-fn, r=TaKO8Ki
Split function parsing out of `item.rs` to a new module. `item.rs` is approaching the tidy-enforced length limit, and this will make room for new additions. I have split this change out of PR #159044 to reduce its complexity (and because this large code move quickly becomes stale).
2 parents 8384a31 + 0c1fefd commit bafc9b3

5 files changed

Lines changed: 1032 additions & 1016 deletions

File tree

compiler/rustc_parse/src/parser/diagnostics.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ use crate::diagnostics::{
4343
UseEqInstead, WrapType,
4444
};
4545
use crate::exp;
46-
use crate::parser::FnContext;
4746
use crate::parser::attr::InnerAttrPolicy;
48-
use crate::parser::item::IsDotDotDot;
47+
use crate::parser::{FnContext, IsDotDotDot};
4948

5049
/// Creates a placeholder argument.
5150
pub(super) fn dummy_arg(ident: Ident, guar: ErrorGuaranteed) -> Param {
@@ -2240,7 +2239,7 @@ impl<'a> Parser<'a> {
22402239
pat: Box<ast::Pat>,
22412240
require_name: bool,
22422241
first_param: bool,
2243-
fn_parse_mode: &crate::parser::item::FnParseMode,
2242+
fn_parse_mode: &crate::parser::FnParseMode,
22442243
) -> Option<Ident> {
22452244
// If we find a pattern followed by an identifier, it could be an (incorrect)
22462245
// C-style parameter declaration.
@@ -2265,7 +2264,7 @@ impl<'a> Parser<'a> {
22652264
{
22662265
let maybe_emit_anon_params_note = |this: &mut Self, err: &mut Diag<'_>| {
22672266
let ed = this.token.span.with_neighbor(this.prev_token.span).edition();
2268-
if matches!(fn_parse_mode.context, crate::parser::item::FnContext::Trait)
2267+
if matches!(fn_parse_mode.context, crate::parser::FnContext::Trait)
22692268
&& (fn_parse_mode.req_name)(ed, IsDotDotDot::No)
22702269
{
22712270
err.note("anonymous parameters are removed in the 2018 edition (see RFC 1685)");

0 commit comments

Comments
 (0)