Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6bf6d50

Browse files
committedAug 19, 2018
Auto merge of #52953 - dsciarra:mv-codemap-sourcemap, r=petrochenkov
Rename CodeMap/FileMap to SourceMap/SourceFile A first renaming for #51574
2 parents f28f648 + 6138c82 commit 6bf6d50

File tree

164 files changed

+879
-858
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+879
-858
lines changed
 

‎src/libproc_macro/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ use syntax::errors::DiagnosticBuilder;
6363
use syntax::parse::{self, token};
6464
use syntax::symbol::Symbol;
6565
use syntax::tokenstream;
66-
use syntax_pos::{FileMap, Pos, FileName};
66+
use syntax_pos::{Pos, FileName};
6767

6868
/// The main type provided by this crate, representing an abstract stream of
6969
/// tokens, or, more specifically, a sequence of token trees.
@@ -308,7 +308,7 @@ impl Span {
308308
#[unstable(feature = "proc_macro_span", issue = "38356")]
309309
pub fn source_file(&self) -> SourceFile {
310310
SourceFile {
311-
filemap: __internal::lookup_char_pos(self.0.lo()).file,
311+
source_file: __internal::lookup_char_pos(self.0.lo()).file,
312312
}
313313
}
314314

@@ -419,7 +419,7 @@ impl !Sync for LineColumn {}
419419
#[unstable(feature = "proc_macro_span", issue = "38356")]
420420
#[derive(Clone)]
421421
pub struct SourceFile {
422-
filemap: Lrc<FileMap>,
422+
source_file: Lrc<syntax_pos::SourceFile>,
423423
}
424424

425425
#[unstable(feature = "proc_macro_span", issue = "38356")]
@@ -432,17 +432,17 @@ impl SourceFile {
432432
///
433433
/// ### Note
434434
/// If the code span associated with this `SourceFile` was generated by an external macro, this
435-
/// may not be an actual path on the filesystem. Use [`is_real`] to check.
435+
/// macro, this may not be an actual path on the filesystem. Use [`is_real`] to check.
436436
///
437437
/// Also note that even if `is_real` returns `true`, if `--remap-path-prefix` was passed on
438438
/// the command line, the path as given may not actually be valid.
439439
///
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

@@ -1186,7 +1186,7 @@ pub mod __internal {
11861186
use super::{TokenStream, LexError, Span};
11871187

11881188
pub fn lookup_char_pos(pos: BytePos) -> Loc {
1189-
with_sess(|sess, _| sess.codemap().lookup_char_pos(pos))
1189+
with_sess(|sess, _| sess.source_map().lookup_char_pos(pos))
11901190
}
11911191

11921192
pub fn new_token_stream(item: P<ast::Item>) -> TokenStream {

‎src/librustc/hir/lowering.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ use syntax::errors;
6868
use syntax::ext::hygiene::{Mark, SyntaxContext};
6969
use syntax::print::pprust;
7070
use syntax::ptr::P;
71-
use syntax::codemap::{self, respan, CompilerDesugaringKind, Spanned};
71+
use syntax::source_map::{self, respan, CompilerDesugaringKind, Spanned};
7272
use syntax::std_inject;
7373
use syntax::symbol::{keywords, Symbol};
7474
use syntax::tokenstream::{Delimited, TokenStream, TokenTree};
@@ -614,14 +614,14 @@ impl<'a> LoweringContext<'a> {
614614

615615
fn allow_internal_unstable(&self, reason: CompilerDesugaringKind, span: Span) -> Span {
616616
let mark = Mark::fresh(Mark::root());
617-
mark.set_expn_info(codemap::ExpnInfo {
617+
mark.set_expn_info(source_map::ExpnInfo {
618618
call_site: span,
619619
def_site: Some(span),
620-
format: codemap::CompilerDesugaring(reason),
620+
format: source_map::CompilerDesugaring(reason),
621621
allow_internal_unstable: true,
622622
allow_internal_unsafe: false,
623623
local_inner_macros: false,
624-
edition: codemap::hygiene::default_edition(),
624+
edition: source_map::hygiene::default_edition(),
625625
});
626626
span.with_ctxt(SyntaxContext::empty().apply_mark(mark))
627627
}
@@ -3621,7 +3621,7 @@ impl<'a> LoweringContext<'a> {
36213621
let tail = block.expr.take().map_or_else(
36223622
|| {
36233623
let LoweredNodeId { node_id, hir_id } = this.next_id();
3624-
let span = this.sess.codemap().end_point(unstable_span);
3624+
let span = this.sess.source_map().end_point(unstable_span);
36253625
hir::Expr {
36263626
id: node_id,
36273627
span,

0 commit comments

Comments
 (0)
Please sign in to comment.