diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2025-09-08 19:25:22 +0200 | 
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2025-09-09 19:49:40 +0200 | 
| commit | 7a66925a8138df105f77d646f9206024baf7ea4b (patch) | |
| tree | 5b781c7d3b815a5b916a13866d1c2e3d79e7b40e /compiler/rustc_expand/src/module.rs | |
| parent | ec8725010120bfbe0430ea54ab820db1d9ed84eb (diff) | |
| download | rust-7a66925a8138df105f77d646f9206024baf7ea4b.tar.gz rust-7a66925a8138df105f77d646f9206024baf7ea4b.zip | |
Strip frontmatter in fewer places
Diffstat (limited to 'compiler/rustc_expand/src/module.rs')
| -rw-r--r-- | compiler/rustc_expand/src/module.rs | 9 | 
1 files changed, 7 insertions, 2 deletions
| diff --git a/compiler/rustc_expand/src/module.rs b/compiler/rustc_expand/src/module.rs index 19f3cdbc549..79ab3cab22c 100644 --- a/compiler/rustc_expand/src/module.rs +++ b/compiler/rustc_expand/src/module.rs @@ -4,6 +4,7 @@ use std::path::{self, Path, PathBuf}; use rustc_ast::{AttrVec, Attribute, Inline, Item, ModSpans}; use rustc_attr_parsing::validate_attr; use rustc_errors::{Diag, ErrorGuaranteed}; +use rustc_parse::lexer::StripTokens; use rustc_parse::{exp, new_parser_from_file, unwrap_or_emit_fatal}; use rustc_session::Session; use rustc_session::parse::ParseSess; @@ -67,8 +68,12 @@ pub(crate) fn parse_external_mod( } // Actually parse the external file as a module. - let mut parser = - unwrap_or_emit_fatal(new_parser_from_file(&sess.psess, &mp.file_path, Some(span))); + let mut parser = unwrap_or_emit_fatal(new_parser_from_file( + &sess.psess, + &mp.file_path, + StripTokens::ShebangAndFrontmatter, + Some(span), + )); let (inner_attrs, items, inner_span) = parser.parse_mod(exp!(Eof)).map_err(|err| ModError::ParserError(err))?; attrs.extend(inner_attrs); | 
