about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2022-01-20 11:06:45 -0500
committerFelix S. Klock II <pnkfelix@pnkfx.org>2022-03-03 14:38:50 -0500
commite9035f7bef47c21b575af517dce309d96df4eb51 (patch)
tree80f987621f14399c7966823d918f29fd767428bd /compiler/rustc_parse/src/parser
parent45660949132222ba7ec0905649b2affd68e0e13c (diff)
downloadrust-e9035f7bef47c21b575af517dce309d96df4eb51.tar.gz
rust-e9035f7bef47c21b575af517dce309d96df4eb51.zip
refactor: prepare to associate multiple spans with a module.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/item.rs7
1 files changed, 4 insertions, 3 deletions
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<Attribute>, Vec<P<Item>>, Span)> {
+    ) -> PResult<'a, (Vec<Attribute>, Vec<P<Item>>, 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) }))
     }
 }