From e9035f7bef47c21b575af517dce309d96df4eb51 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Thu, 20 Jan 2022 11:06:45 -0500 Subject: refactor: prepare to associate multiple spans with a module. --- compiler/rustc_parse/src/parser/item.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'compiler/rustc_parse') diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index ae46bfe3540..aa0d8d68748 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -26,7 +26,8 @@ use tracing::debug; impl<'a> Parser<'a> { /// Parses a source module as a crate. This is the main entry point for the parser. pub fn parse_crate_mod(&mut self) -> PResult<'a, ast::Crate> { - let (attrs, items, span) = self.parse_mod(&token::Eof)?; + let (attrs, items, spans) = self.parse_mod(&token::Eof)?; + let span = spans.inner_span; Ok(ast::Crate { attrs, items, span, id: DUMMY_NODE_ID, is_placeholder: false }) } @@ -51,7 +52,7 @@ impl<'a> Parser<'a> { pub fn parse_mod( &mut self, term: &TokenKind, - ) -> PResult<'a, (Vec, Vec>, Span)> { + ) -> PResult<'a, (Vec, Vec>, ModSpans)> { let lo = self.token.span; let attrs = self.parse_inner_attributes()?; @@ -71,7 +72,7 @@ impl<'a> Parser<'a> { } } - Ok((attrs, items, lo.to(self.prev_token.span))) + Ok((attrs, items, ModSpans { inner_span: lo.to(self.prev_token.span) })) } } -- cgit 1.4.1-3-g733a5