Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 74876ef

Browse files
committed
Associate multiple with a crate too.
1 parent 4edb757 commit 74876ef

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/modules.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'ast, 'sess, 'c> ModResolver<'ast, 'sess> {
124124
mut self,
125125
krate: &'ast ast::Crate,
126126
) -> Result<FileModMap<'ast>, ModuleResolutionError> {
127-
let root_filename = self.parse_sess.span_to_filename(krate.span);
127+
let root_filename = self.parse_sess.span_to_filename(krate.spans.inner_span);
128128
self.directory.path = match root_filename {
129129
FileName::Real(ref p) => p.parent().unwrap_or(Path::new("")).to_path_buf(),
130130
_ => PathBuf::new(),
@@ -135,7 +135,7 @@ impl<'ast, 'sess, 'c> ModResolver<'ast, 'sess> {
135135
self.visit_mod_from_ast(&krate.items)?;
136136
}
137137

138-
let snippet_provider = self.parse_sess.snippet_provider(krate.span);
138+
let snippet_provider = self.parse_sess.snippet_provider(krate.spans.inner_span);
139139

140140
self.file_map.insert(
141141
root_filename,

src/visitor.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,8 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
915915
let ident_str = rewrite_ident(&self.get_context(), ident).to_owned();
916916
self.push_str(&ident_str);
917917

918-
if let ast::ModKind::Loaded(ref items, ast::Inline::Yes, ast::ModSpans{ inner_span }) = mod_kind {
918+
if let ast::ModKind::Loaded(ref items, ast::Inline::Yes, ref spans) = mod_kind {
919+
let ast::ModSpans { inner_span } = *spans;
919920
match self.config.brace_style() {
920921
BraceStyle::AlwaysNextLine => {
921922
let indent_str = self.block_indent.to_string_with_newline(self.config);

0 commit comments

Comments
 (0)