Skip to content

Commit cbd0595

Browse files
committed
mv filemap source_file
1 parent d6dcbcd commit cbd0595

File tree

25 files changed

+209
-209
lines changed

25 files changed

+209
-209
lines changed

src/libproc_macro/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,9 @@ impl SourceFile {
440440
/// [`is_real`]: #method.is_real
441441
#[unstable(feature = "proc_macro_span", issue = "38356")]
442442
pub fn path(&self) -> PathBuf {
443-
match self.filemap.name {
443+
match self.source_file.name {
444444
FileName::Real(ref path) => path.clone(),
445-
_ => PathBuf::from(self.filemap.name.to_string())
445+
_ => PathBuf::from(self.source_file.name.to_string())
446446
}
447447
}
448448

@@ -453,7 +453,7 @@ impl SourceFile {
453453
// This is a hack until intercrate spans are implemented and we can have real source files
454454
// for spans generated in external macros.
455455
// https://github.com/rust-lang/rust/pull/43604#issuecomment-333334368
456-
self.filemap.is_real_file()
456+
self.source_file.is_real_file()
457457
}
458458
}
459459

@@ -471,7 +471,7 @@ impl fmt::Debug for SourceFile {
471471
#[unstable(feature = "proc_macro_span", issue = "38356")]
472472
impl PartialEq for SourceFile {
473473
fn eq(&self, other: &Self) -> bool {
474-
Lrc::ptr_eq(&self.filemap, &other.filemap)
474+
Lrc::ptr_eq(&self.source_file, &other.source_file)
475475
}
476476
}
477477

src/librustc/hir/map/collector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
158158
let mut source_file_names: Vec<_> = codemap
159159
.files()
160160
.iter()
161-
.filter(|filemap| CrateNum::from_u32(filemap.crate_of_origin) == LOCAL_CRATE)
162-
.map(|filemap| filemap.name_hash)
161+
.filter(|source_file| CrateNum::from_u32(source_file.crate_of_origin) == LOCAL_CRATE)
162+
.map(|source_file| source_file.name_hash)
163163
.collect();
164164

165165
source_file_names.sort_unstable();

src/librustc/ich/caching_codemap_view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl<'cm> CachingCodemapView<'cm> {
7979
if pos < cache_entry.file.start_pos || pos >= cache_entry.file.end_pos {
8080
let file_valid;
8181
if self.codemap.files().len() > 0 {
82-
let file_index = self.codemap.lookup_filemap_idx(pos);
82+
let file_index = self.codemap.lookup_source_file_idx(pos);
8383
let file = self.codemap.files()[file_index].clone();
8484

8585
if pos >= file.start_pos && pos < file.end_pos {

src/librustc/ich/impls_syntax.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,13 @@ impl<'a> HashStable<StableHashingContext<'a>> for SourceFile {
458458

459459
src_hash.hash_stable(hcx, hasher);
460460

461-
// We only hash the relative position within this filemap
461+
// We only hash the relative position within this source_file
462462
lines.len().hash_stable(hcx, hasher);
463463
for &line in lines.iter() {
464464
stable_byte_pos(line, start_pos).hash_stable(hcx, hasher);
465465
}
466466

467-
// We only hash the relative position within this filemap
467+
// We only hash the relative position within this source_file
468468
multibyte_chars.len().hash_stable(hcx, hasher);
469469
for &char_pos in multibyte_chars.iter() {
470470
stable_multibyte_char(char_pos, start_pos).hash_stable(hcx, hasher);
@@ -478,29 +478,29 @@ impl<'a> HashStable<StableHashingContext<'a>> for SourceFile {
478478
}
479479

480480
fn stable_byte_pos(pos: ::syntax_pos::BytePos,
481-
filemap_start: ::syntax_pos::BytePos)
481+
source_file_start: ::syntax_pos::BytePos)
482482
-> u32 {
483-
pos.0 - filemap_start.0
483+
pos.0 - source_file_start.0
484484
}
485485

486486
fn stable_multibyte_char(mbc: ::syntax_pos::MultiByteChar,
487-
filemap_start: ::syntax_pos::BytePos)
487+
source_file_start: ::syntax_pos::BytePos)
488488
-> (u32, u32) {
489489
let ::syntax_pos::MultiByteChar {
490490
pos,
491491
bytes,
492492
} = mbc;
493493

494-
(pos.0 - filemap_start.0, bytes as u32)
494+
(pos.0 - source_file_start.0, bytes as u32)
495495
}
496496

497497
fn stable_non_narrow_char(swc: ::syntax_pos::NonNarrowChar,
498-
filemap_start: ::syntax_pos::BytePos)
498+
source_file_start: ::syntax_pos::BytePos)
499499
-> (u32, u32) {
500500
let pos = swc.pos();
501501
let width = swc.width();
502502

503-
(pos.0 - filemap_start.0, width as u32)
503+
(pos.0 - source_file_start.0, width as u32)
504504
}
505505

506506

src/librustc/ty/query/on_disk_cache.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ impl<'a, 'tcx, 'x> CacheDecoder<'a, 'tcx, 'x> {
494494

495495
file_index_to_file.borrow_mut().entry(index).or_insert_with(|| {
496496
let stable_id = file_index_to_stable_id[&index];
497-
codemap.filemap_by_stable_id(stable_id)
497+
codemap.source_file_by_stable_id(stable_id)
498498
.expect("Failed to lookup SourceFile in new context.")
499499
}).clone()
500500
}
@@ -777,8 +777,8 @@ struct CacheEncoder<'enc, 'a, 'tcx, E>
777777
impl<'enc, 'a, 'tcx, E> CacheEncoder<'enc, 'a, 'tcx, E>
778778
where E: 'enc + ty_codec::TyEncoder
779779
{
780-
fn filemap_index(&mut self, filemap: Lrc<SourceFile>) -> SourceFileIndex {
781-
self.file_to_file_index[&(&*filemap as *const SourceFile)]
780+
fn source_file_index(&mut self, source_file: Lrc<SourceFile>) -> SourceFileIndex {
781+
self.file_to_file_index[&(&*source_file as *const SourceFile)]
782782
}
783783

784784
/// Encode something with additional information that allows to do some
@@ -850,10 +850,10 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder<Span> for CacheEncoder<'enc, 'a, 'tcx
850850

851851
let len = span_data.hi - span_data.lo;
852852

853-
let filemap_index = self.filemap_index(file_lo);
853+
let source_file_index = self.source_file_index(file_lo);
854854

855855
TAG_VALID_SPAN.encode(self)?;
856-
filemap_index.encode(self)?;
856+
source_file_index.encode(self)?;
857857
line_lo.encode(self)?;
858858
col_lo.encode(self)?;
859859
len.encode(self)?;

src/librustc_driver/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ pub fn fold_crate(sess: &Session, krate: ast::Crate, ppm: PpMode) -> ast::Crate
916916
fn get_source(input: &Input, sess: &Session) -> (Vec<u8>, FileName) {
917917
let src_name = driver::source_name(input);
918918
let src = sess.codemap()
919-
.get_filemap(&src_name)
919+
.get_source_file(&src_name)
920920
.unwrap()
921921
.src
922922
.as_ref()

src/librustc_errors/emitter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ impl EmitterWriter {
10211021
// Print out the annotate source lines that correspond with the error
10221022
for annotated_file in annotated_files {
10231023
// we can't annotate anything if the source is unavailable.
1024-
if !cm.ensure_filemap_source_present(annotated_file.file.clone()) {
1024+
if !cm.ensure_source_file_source_present(annotated_file.file.clone()) {
10251025
continue;
10261026
}
10271027

src/librustc_errors/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub trait SourceMapper {
120120
fn span_to_filename(&self, sp: Span) -> FileName;
121121
fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>;
122122
fn call_span_if_macro(&self, sp: Span) -> Span;
123-
fn ensure_filemap_source_present(&self, file_map: Lrc<SourceFile>) -> bool;
123+
fn ensure_source_file_source_present(&self, file_map: Lrc<SourceFile>) -> bool;
124124
fn doctest_offset_line(&self, line: usize) -> usize;
125125
}
126126

src/librustc_metadata/cstore.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ pub use rustc_data_structures::sync::MetadataRef;
4242
pub struct MetadataBlob(pub MetadataRef);
4343

4444
/// Holds information about a syntax_pos::SourceFile imported from another crate.
45-
/// See `imported_filemaps()` for more information.
45+
/// See `imported_source_files()` for more information.
4646
pub struct ImportedSourceFile {
4747
/// This SourceFile's byte-offset within the codemap of its original crate
4848
pub original_start_pos: syntax_pos::BytePos,
4949
/// The end of this SourceFile within the codemap of its original crate
5050
pub original_end_pos: syntax_pos::BytePos,
5151
/// The imported SourceFile's representation within the local codemap
52-
pub translated_filemap: Lrc<syntax_pos::SourceFile>,
52+
pub translated_source_file: Lrc<syntax_pos::SourceFile>,
5353
}
5454

5555
pub struct CrateMetadata {

src/librustc_metadata/cstore_impl.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use syntax::ast;
4040
use syntax::attr;
4141
use syntax::codemap;
4242
use syntax::edition::Edition;
43-
use syntax::parse::filemap_to_stream;
43+
use syntax::parse::source_file_to_stream;
4444
use syntax::symbol::Symbol;
4545
use syntax_pos::{Span, NO_EXPANSION, FileName};
4646
use rustc_data_structures::indexed_set::IdxSetBuf;
@@ -463,9 +463,9 @@ impl cstore::CStore {
463463
let (name, def) = data.get_macro(id.index);
464464
let source_name = FileName::Macros(name.to_string());
465465

466-
let filemap = sess.parse_sess.codemap().new_filemap(source_name, def.body);
467-
let local_span = Span::new(filemap.start_pos, filemap.end_pos, NO_EXPANSION);
468-
let body = filemap_to_stream(&sess.parse_sess, filemap, None);
466+
let source_file = sess.parse_sess.codemap().new_source_file(source_name, def.body);
467+
let local_span = Span::new(source_file.start_pos, source_file.end_pos, NO_EXPANSION);
468+
let body = source_file_to_stream(&sess.parse_sess, source_file, None);
469469

470470
// Mark the attrs as used
471471
let attrs = data.get_item_attrs(id.index, sess);

0 commit comments

Comments
 (0)