Skip to content

Commit

Permalink
Make minor modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
sonmarcho committed Oct 2, 2024
1 parent a10804d commit 59655d0
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,20 @@ impl<'tcx, 'ctx> TranslateCtx<'tcx, 'ctx> {
}

/// Return a map from source file name to file content.
///
/// Note that we collect *all* the source files found in the session,
/// including the source files from the dependencies. We later filter
/// those to build a map from the file names we actually refer to in
/// the spans to the file contents (ignoring the other files). This
/// is the reason why here we build a map from file name to `Arc<String>`
/// and not directly to `String`: we don't want to clone too much data.
fn read_source_files(&mut self) -> HashMap<FileName, Arc<String>> {
// Retrieve the source map
let source_map = self.tcx.sess.source_map();

// Read all the files
use std::ops::Deref;
source_map
.files()
.deref()
.iter()
.filter_map(|file| {
// Convert the filename
Expand Down

0 comments on commit 59655d0

Please sign in to comment.