about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorDonato Sciarra <sciarp@gmail.com>2018-08-18 12:13:35 +0200
committerDonato Sciarra <sciarp@gmail.com>2018-08-19 23:00:59 +0200
commitc65547337831babea8d9052b960649309263df36 (patch)
treee33b9c8d595cc8d8cf59b844daadfc390c24b368 /src/libsyntax
parent3ac79c718475fd29b8be34dde667b683390c2aee (diff)
downloadrust-c65547337831babea8d9052b960649309263df36.tar.gz
rust-c65547337831babea8d9052b960649309263df36.zip
mv CodeMap SourceMap
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/codemap.rs58
-rw-r--r--src/libsyntax/ext/base.rs4
-rw-r--r--src/libsyntax/json.rs12
-rw-r--r--src/libsyntax/parse/lexer/comments.rs4
-rw-r--r--src/libsyntax/parse/lexer/mod.rs36
-rw-r--r--src/libsyntax/parse/mod.rs10
-rw-r--r--src/libsyntax/parse/parser.rs4
-rw-r--r--src/libsyntax/print/pprust.rs10
-rw-r--r--src/libsyntax/test.rs2
-rw-r--r--src/libsyntax/test_snippet.rs4
10 files changed, 72 insertions, 72 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index 0a9991d33b1..8175e2495c5 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! The CodeMap tracks all the source code used within a single crate, mapping
+//! The SourceMap tracks all the source code used within a single crate, mapping
 //! from integer byte positions to the original source code location. Each bit
 //! of source parsed during crate parsing (typically files, in-memory strings,
 //! or various bits of macro expansion) cover a continuous range of bytes in the
-//! CodeMap and are represented by FileMaps. Byte positions are stored in
+//! SourceMap and are represented by FileMaps. Byte positions are stored in
 //! `spans` and used pervasively in the compiler. They are absolute positions
-//! within the CodeMap, which upon request can be converted to line and column
+//! within the SourceMap, which upon request can be converted to line and column
 //! information, source code snippets, etc.
 
 
@@ -32,7 +32,7 @@ use std::path::{Path, PathBuf};
 use std::env;
 use std::fs;
 use std::io::{self, Read};
-use errors::CodeMapper;
+use errors::SourceMapper;
 
 /// Return the span itself if it doesn't come from a macro expansion,
 /// otherwise return the call site span up to the `enclosing_sp` by
@@ -121,29 +121,29 @@ impl StableFilemapId {
 }
 
 // _____________________________________________________________________________
-// CodeMap
+// SourceMap
 //
 
-pub(super) struct CodeMapFiles {
+pub(super) struct SourceMapFiles {
     pub(super) file_maps: Vec<Lrc<FileMap>>,
     stable_id_to_filemap: FxHashMap<StableFilemapId, Lrc<FileMap>>
 }
 
-pub struct CodeMap {
-    pub(super) files: Lock<CodeMapFiles>,
+pub struct SourceMap {
+    pub(super) files: Lock<SourceMapFiles>,
     file_loader: Box<dyn FileLoader + Sync + Send>,
     // This is used to apply the file path remapping as specified via
-    // --remap-path-prefix to all FileMaps allocated within this CodeMap.
+    // --remap-path-prefix to all FileMaps allocated within this SourceMap.
     path_mapping: FilePathMapping,
     /// In case we are in a doctest, replace all file names with the PathBuf,
     /// and add the given offsets to the line info
     doctest_offset: Option<(FileName, isize)>,
 }
 
-impl CodeMap {
-    pub fn new(path_mapping: FilePathMapping) -> CodeMap {
-        CodeMap {
-            files: Lock::new(CodeMapFiles {
+impl SourceMap {
+    pub fn new(path_mapping: FilePathMapping) -> SourceMap {
+        SourceMap {
+            files: Lock::new(SourceMapFiles {
                 file_maps: Vec::new(),
                 stable_id_to_filemap: FxHashMap(),
             }),
@@ -154,19 +154,19 @@ impl CodeMap {
     }
 
     pub fn new_doctest(path_mapping: FilePathMapping,
-                       file: FileName, line: isize) -> CodeMap {
-        CodeMap {
+                       file: FileName, line: isize) -> SourceMap {
+        SourceMap {
             doctest_offset: Some((file, line)),
-            ..CodeMap::new(path_mapping)
+            ..SourceMap::new(path_mapping)
         }
 
     }
 
     pub fn with_file_loader(file_loader: Box<dyn FileLoader + Sync + Send>,
                             path_mapping: FilePathMapping)
-                            -> CodeMap {
-        CodeMap {
-            files: Lock::new(CodeMapFiles {
+                            -> SourceMap {
+        SourceMap {
+            files: Lock::new(SourceMapFiles {
                 file_maps: Vec::new(),
                 stable_id_to_filemap: FxHashMap(),
             }),
@@ -463,7 +463,7 @@ impl CodeMap {
 
     pub fn span_to_unmapped_path(&self, sp: Span) -> FileName {
         self.lookup_char_pos(sp.lo()).file.unmapped_path.clone()
-            .expect("CodeMap::span_to_unmapped_path called for imported FileMap?")
+            .expect("SourceMap::span_to_unmapped_path called for imported FileMap?")
     }
 
     pub fn is_multiline(&self, sp: Span) -> bool {
@@ -941,7 +941,7 @@ impl CodeMap {
     }
 }
 
-impl CodeMapper for CodeMap {
+impl SourceMapper for SourceMap {
     fn lookup_char_pos(&self, pos: BytePos) -> Loc {
         self.lookup_char_pos(pos)
     }
@@ -1023,8 +1023,8 @@ mod tests {
     use super::*;
     use rustc_data_structures::sync::Lrc;
 
-    fn init_code_map() -> CodeMap {
-        let cm = CodeMap::new(FilePathMapping::empty());
+    fn init_code_map() -> SourceMap {
+        let cm = SourceMap::new(FilePathMapping::empty());
         cm.new_filemap(PathBuf::from("blork.rs").into(),
                        "first line.\nsecond line".to_string());
         cm.new_filemap(PathBuf::from("empty.rs").into(),
@@ -1080,8 +1080,8 @@ mod tests {
         assert_eq!(loc2.col, CharPos(0));
     }
 
-    fn init_code_map_mbc() -> CodeMap {
-        let cm = CodeMap::new(FilePathMapping::empty());
+    fn init_code_map_mbc() -> SourceMap {
+        let cm = SourceMap::new(FilePathMapping::empty());
         // € is a three byte utf8 char.
         cm.new_filemap(PathBuf::from("blork.rs").into(),
                        "fir€st €€€€ line.\nsecond line".to_string());
@@ -1135,7 +1135,7 @@ mod tests {
     /// lines in the middle of a file.
     #[test]
     fn span_to_snippet_and_lines_spanning_multiple_lines() {
-        let cm = CodeMap::new(FilePathMapping::empty());
+        let cm = SourceMap::new(FilePathMapping::empty());
         let inputtext = "aaaaa\nbbbbBB\nCCC\nDDDDDddddd\neee\n";
         let selection = "     \n    ~~\n~~~\n~~~~~     \n   \n";
         cm.new_filemap(Path::new("blork.rs").to_owned().into(), inputtext.to_string());
@@ -1177,7 +1177,7 @@ mod tests {
     /// Test failing to merge two spans on different lines
     #[test]
     fn span_merging_fail() {
-        let cm = CodeMap::new(FilePathMapping::empty());
+        let cm = SourceMap::new(FilePathMapping::empty());
         let inputtext  = "bbbb BB\ncc CCC\n";
         let selection1 = "     ~~\n      \n";
         let selection2 = "       \n   ~~~\n";
@@ -1190,7 +1190,7 @@ mod tests {
 
     /// Returns the span corresponding to the `n`th occurrence of
     /// `substring` in `source_text`.
-    trait CodeMapExtension {
+    trait SourceMapExtension {
         fn span_substr(&self,
                     file: &Lrc<FileMap>,
                     source_text: &str,
@@ -1199,7 +1199,7 @@ mod tests {
                     -> Span;
     }
 
-    impl CodeMapExtension for CodeMap {
+    impl SourceMapExtension for SourceMap {
         fn span_substr(&self,
                     file: &Lrc<FileMap>,
                     source_text: &str,
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 482d8c2cf98..8ae4f9c1aa4 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -12,7 +12,7 @@ pub use self::SyntaxExtension::*;
 
 use ast::{self, Attribute, Name, PatKind, MetaItem};
 use attr::HasAttrs;
-use codemap::{self, CodeMap, Spanned, respan};
+use codemap::{self, SourceMap, Spanned, respan};
 use syntax_pos::{Span, MultiSpan, DUMMY_SP};
 use edition::Edition;
 use errors::{DiagnosticBuilder, DiagnosticId};
@@ -836,7 +836,7 @@ impl<'a> ExtCtxt<'a> {
     pub fn new_parser_from_tts(&self, tts: &[tokenstream::TokenTree]) -> parser::Parser<'a> {
         parse::stream_to_parser(self.parse_sess, tts.iter().cloned().collect())
     }
-    pub fn codemap(&self) -> &'a CodeMap { self.parse_sess.codemap() }
+    pub fn codemap(&self) -> &'a SourceMap { self.parse_sess.codemap() }
     pub fn parse_sess(&self) -> &'a parse::ParseSess { self.parse_sess }
     pub fn cfg(&self) -> &ast::CrateConfig { &self.parse_sess.config }
     pub fn call_site(&self) -> Span {
diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs
index 65de1503966..22de184938f 100644
--- a/src/libsyntax/json.rs
+++ b/src/libsyntax/json.rs
@@ -19,10 +19,10 @@
 
 // FIXME spec the JSON output properly.
 
-use codemap::{CodeMap, FilePathMapping};
+use codemap::{SourceMap, FilePathMapping};
 use syntax_pos::{self, MacroBacktrace, Span, SpanLabel, MultiSpan};
 use errors::registry::Registry;
-use errors::{DiagnosticBuilder, SubDiagnostic, CodeSuggestion, CodeMapper};
+use errors::{DiagnosticBuilder, SubDiagnostic, CodeSuggestion, SourceMapper};
 use errors::{DiagnosticId, Applicability};
 use errors::emitter::{Emitter, EmitterWriter};
 
@@ -36,14 +36,14 @@ use rustc_serialize::json::{as_json, as_pretty_json};
 pub struct JsonEmitter {
     dst: Box<dyn Write + Send>,
     registry: Option<Registry>,
-    cm: Lrc<dyn CodeMapper + sync::Send + sync::Sync>,
+    cm: Lrc<dyn SourceMapper + sync::Send + sync::Sync>,
     pretty: bool,
     ui_testing: bool,
 }
 
 impl JsonEmitter {
     pub fn stderr(registry: Option<Registry>,
-                  code_map: Lrc<CodeMap>,
+                  code_map: Lrc<SourceMap>,
                   pretty: bool) -> JsonEmitter {
         JsonEmitter {
             dst: Box::new(io::stderr()),
@@ -56,13 +56,13 @@ impl JsonEmitter {
 
     pub fn basic(pretty: bool) -> JsonEmitter {
         let file_path_mapping = FilePathMapping::empty();
-        JsonEmitter::stderr(None, Lrc::new(CodeMap::new(file_path_mapping)),
+        JsonEmitter::stderr(None, Lrc::new(SourceMap::new(file_path_mapping)),
                             pretty)
     }
 
     pub fn new(dst: Box<dyn Write + Send>,
                registry: Option<Registry>,
-               code_map: Lrc<CodeMap>,
+               code_map: Lrc<SourceMap>,
                pretty: bool) -> JsonEmitter {
         JsonEmitter {
             dst,
diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs
index 2c53dbdc402..2c227756f9a 100644
--- a/src/libsyntax/parse/lexer/comments.rs
+++ b/src/libsyntax/parse/lexer/comments.rs
@@ -11,7 +11,7 @@
 pub use self::CommentStyle::*;
 
 use ast;
-use codemap::CodeMap;
+use codemap::SourceMap;
 use syntax_pos::{BytePos, CharPos, Pos, FileName};
 use parse::lexer::{is_block_doc_comment, is_pattern_whitespace};
 use parse::lexer::{self, ParseSess, StringReader, TokenAndSpan};
@@ -371,7 +371,7 @@ pub fn gather_comments_and_literals(sess: &ParseSess, path: FileName, srdr: &mut
 {
     let mut src = String::new();
     srdr.read_to_string(&mut src).unwrap();
-    let cm = CodeMap::new(sess.codemap().path_mapping().clone());
+    let cm = SourceMap::new(sess.codemap().path_mapping().clone());
     let filemap = cm.new_filemap(path, src);
     let mut rdr = lexer::StringReader::new_raw(sess, filemap, None);
 
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index bdf25618f47..c1919434e37 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -10,7 +10,7 @@
 
 use ast::{self, Ident};
 use syntax_pos::{self, BytePos, CharPos, Pos, Span, NO_EXPANSION};
-use codemap::{CodeMap, FilePathMapping};
+use codemap::{SourceMap, FilePathMapping};
 use errors::{Applicability, FatalError, DiagnosticBuilder};
 use parse::{token, ParseSess};
 use str::char_at;
@@ -622,7 +622,7 @@ impl<'a> StringReader<'a> {
 
                 // I guess this is the only way to figure out if
                 // we're at the beginning of the file...
-                let cmap = CodeMap::new(FilePathMapping::empty());
+                let cmap = SourceMap::new(FilePathMapping::empty());
                 cmap.files.borrow_mut().file_maps.push(self.filemap.clone());
                 let loc = cmap.lookup_char_pos_adj(self.pos);
                 debug!("Skipping a shebang");
@@ -1827,7 +1827,7 @@ mod tests {
     use ast::{Ident, CrateConfig};
     use symbol::Symbol;
     use syntax_pos::{BytePos, Span, NO_EXPANSION};
-    use codemap::CodeMap;
+    use codemap::SourceMap;
     use errors;
     use feature_gate::UnstableFeatures;
     use parse::token;
@@ -1837,7 +1837,7 @@ mod tests {
     use diagnostics::plugin::ErrorMap;
     use rustc_data_structures::sync::Lock;
     use with_globals;
-    fn mk_sess(cm: Lrc<CodeMap>) -> ParseSess {
+    fn mk_sess(cm: Lrc<SourceMap>) -> ParseSess {
         let emitter = errors::emitter::EmitterWriter::new(Box::new(io::sink()),
                                                           Some(cm.clone()),
                                                           false,
@@ -1857,7 +1857,7 @@ mod tests {
     }
 
     // open a string reader for the given string
-    fn setup<'a>(cm: &CodeMap,
+    fn setup<'a>(cm: &SourceMap,
                  sess: &'a ParseSess,
                  teststr: String)
                  -> StringReader<'a> {
@@ -1868,7 +1868,7 @@ mod tests {
     #[test]
     fn t1() {
         with_globals(|| {
-            let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(cm.clone());
             let mut string_reader = setup(&cm,
                                         &sh,
@@ -1916,7 +1916,7 @@ mod tests {
     #[test]
     fn doublecolonparsing() {
         with_globals(|| {
-            let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(cm.clone());
             check_tokenization(setup(&cm, &sh, "a b".to_string()),
                             vec![mk_ident("a"), token::Whitespace, mk_ident("b")]);
@@ -1926,7 +1926,7 @@ mod tests {
     #[test]
     fn dcparsing_2() {
         with_globals(|| {
-            let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(cm.clone());
             check_tokenization(setup(&cm, &sh, "a::b".to_string()),
                             vec![mk_ident("a"), token::ModSep, mk_ident("b")]);
@@ -1936,7 +1936,7 @@ mod tests {
     #[test]
     fn dcparsing_3() {
         with_globals(|| {
-            let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(cm.clone());
             check_tokenization(setup(&cm, &sh, "a ::b".to_string()),
                             vec![mk_ident("a"), token::Whitespace, token::ModSep, mk_ident("b")]);
@@ -1946,7 +1946,7 @@ mod tests {
     #[test]
     fn dcparsing_4() {
         with_globals(|| {
-            let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(cm.clone());
             check_tokenization(setup(&cm, &sh, "a:: b".to_string()),
                             vec![mk_ident("a"), token::ModSep, token::Whitespace, mk_ident("b")]);
@@ -1956,7 +1956,7 @@ mod tests {
     #[test]
     fn character_a() {
         with_globals(|| {
-            let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(cm.clone());
             assert_eq!(setup(&cm, &sh, "'a'".to_string()).next_token().tok,
                     token::Literal(token::Char(Symbol::intern("a")), None));
@@ -1966,7 +1966,7 @@ mod tests {
     #[test]
     fn character_space() {
         with_globals(|| {
-            let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(cm.clone());
             assert_eq!(setup(&cm, &sh, "' '".to_string()).next_token().tok,
                     token::Literal(token::Char(Symbol::intern(" ")), None));
@@ -1976,7 +1976,7 @@ mod tests {
     #[test]
     fn character_escaped() {
         with_globals(|| {
-            let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(cm.clone());
             assert_eq!(setup(&cm, &sh, "'\\n'".to_string()).next_token().tok,
                     token::Literal(token::Char(Symbol::intern("\\n")), None));
@@ -1986,7 +1986,7 @@ mod tests {
     #[test]
     fn lifetime_name() {
         with_globals(|| {
-            let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(cm.clone());
             assert_eq!(setup(&cm, &sh, "'abc".to_string()).next_token().tok,
                     token::Lifetime(Ident::from_str("'abc")));
@@ -1996,7 +1996,7 @@ mod tests {
     #[test]
     fn raw_string() {
         with_globals(|| {
-            let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(cm.clone());
             assert_eq!(setup(&cm, &sh, "r###\"\"#a\\b\x00c\"\"###".to_string())
                         .next_token()
@@ -2008,7 +2008,7 @@ mod tests {
     #[test]
     fn literal_suffixes() {
         with_globals(|| {
-            let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(cm.clone());
             macro_rules! test {
                 ($input: expr, $tok_type: ident, $tok_contents: expr) => {{
@@ -2054,7 +2054,7 @@ mod tests {
     #[test]
     fn nested_block_comments() {
         with_globals(|| {
-            let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(cm.clone());
             let mut lexer = setup(&cm, &sh, "/* /* */ */'a'".to_string());
             match lexer.next_token().tok {
@@ -2069,7 +2069,7 @@ mod tests {
     #[test]
     fn crlf_comments() {
         with_globals(|| {
-            let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+            let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
             let sh = mk_sess(cm.clone());
             let mut lexer = setup(&cm, &sh, "// test\r\n/// test\r\n".to_string());
             let comment = lexer.next_token();
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index d029509f0c1..d43cbf38064 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -13,7 +13,7 @@
 use rustc_data_structures::sync::{Lrc, Lock};
 use ast::{self, CrateConfig, NodeId};
 use early_buffered_lints::{BufferedEarlyLint, BufferedEarlyLintId};
-use codemap::{CodeMap, FilePathMapping};
+use codemap::{SourceMap, FilePathMapping};
 use syntax_pos::{Span, FileMap, FileName, MultiSpan};
 use errors::{Handler, ColorConfig, DiagnosticBuilder};
 use feature_gate::UnstableFeatures;
@@ -57,13 +57,13 @@ pub struct ParseSess {
     pub non_modrs_mods: Lock<Vec<(ast::Ident, Span)>>,
     /// Used to determine and report recursive mod inclusions
     included_mod_stack: Lock<Vec<PathBuf>>,
-    code_map: Lrc<CodeMap>,
+    code_map: Lrc<SourceMap>,
     pub buffered_lints: Lock<Vec<BufferedEarlyLint>>,
 }
 
 impl ParseSess {
     pub fn new(file_path_mapping: FilePathMapping) -> Self {
-        let cm = Lrc::new(CodeMap::new(file_path_mapping));
+        let cm = Lrc::new(SourceMap::new(file_path_mapping));
         let handler = Handler::with_tty_emitter(ColorConfig::Auto,
                                                 true,
                                                 false,
@@ -71,7 +71,7 @@ impl ParseSess {
         ParseSess::with_span_handler(handler, cm)
     }
 
-    pub fn with_span_handler(handler: Handler, code_map: Lrc<CodeMap>) -> ParseSess {
+    pub fn with_span_handler(handler: Handler, code_map: Lrc<SourceMap>) -> ParseSess {
         ParseSess {
             span_diagnostic: handler,
             unstable_features: UnstableFeatures::from_environment(),
@@ -86,7 +86,7 @@ impl ParseSess {
         }
     }
 
-    pub fn codemap(&self) -> &CodeMap {
+    pub fn codemap(&self) -> &SourceMap {
         &self.code_map
     }
 
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 345464c6664..1e6c1eee483 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -42,7 +42,7 @@ use ast::{UseTree, UseTreeKind};
 use ast::{BinOpKind, UnOp};
 use ast::{RangeEnd, RangeSyntax};
 use {ast, attr};
-use codemap::{self, CodeMap, Spanned, respan};
+use codemap::{self, SourceMap, Spanned, respan};
 use syntax_pos::{self, Span, MultiSpan, BytePos, FileName, edition::Edition};
 use errors::{self, Applicability, DiagnosticBuilder, DiagnosticId};
 use parse::{self, SeqSep, classify, token};
@@ -6322,7 +6322,7 @@ impl<'a> Parser<'a> {
         id: ast::Ident,
         relative: Option<ast::Ident>,
         dir_path: &Path,
-        codemap: &CodeMap) -> ModulePath
+        codemap: &SourceMap) -> ModulePath
     {
         // If we're in a foo.rs file instead of a mod.rs file,
         // we need to look for submodules in
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 54ce06f61ef..2646d52b739 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -16,7 +16,7 @@ use ast::{SelfKind, GenericBound, TraitBoundModifier};
 use ast::{Attribute, MacDelimiter, GenericArg};
 use util::parser::{self, AssocOp, Fixity};
 use attr;
-use codemap::{self, CodeMap, Spanned};
+use codemap::{self, SourceMap, Spanned};
 use syntax_pos::{self, BytePos};
 use syntax_pos::hygiene::{Mark, SyntaxContext};
 use parse::token::{self, BinOpToken, Token};
@@ -57,7 +57,7 @@ impl PpAnn for NoAnn {}
 
 pub struct State<'a> {
     pub s: pp::Printer<'a>,
-    cm: Option<&'a CodeMap>,
+    cm: Option<&'a SourceMap>,
     comments: Option<Vec<comments::Comment> >,
     literals: Peekable<vec::IntoIter<comments::Literal>>,
     cur_cmnt: usize,
@@ -84,7 +84,7 @@ pub const DEFAULT_COLUMNS: usize = 78;
 /// Requires you to pass an input filename and reader so that
 /// it can scan the input text for comments and literals to
 /// copy forward.
-pub fn print_crate<'a>(cm: &'a CodeMap,
+pub fn print_crate<'a>(cm: &'a SourceMap,
                        sess: &ParseSess,
                        krate: &ast::Crate,
                        filename: FileName,
@@ -118,7 +118,7 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
 }
 
 impl<'a> State<'a> {
-    pub fn new_from_input(cm: &'a CodeMap,
+    pub fn new_from_input(cm: &'a SourceMap,
                           sess: &ParseSess,
                           filename: FileName,
                           input: &mut dyn Read,
@@ -138,7 +138,7 @@ impl<'a> State<'a> {
             if is_expanded { None } else { Some(lits) })
     }
 
-    pub fn new(cm: &'a CodeMap,
+    pub fn new(cm: &'a SourceMap,
                out: Box<dyn Write+'a>,
                ann: &'a dyn PpAnn,
                comments: Option<Vec<comments::Comment>>,
diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs
index 1cbaf3cc312..633de812a87 100644
--- a/src/libsyntax/test.rs
+++ b/src/libsyntax/test.rs
@@ -22,7 +22,7 @@ use std::vec;
 use attr::{self, HasAttrs};
 use syntax_pos::{self, DUMMY_SP, NO_EXPANSION, Span, FileMap, BytePos};
 
-use codemap::{self, CodeMap, ExpnInfo, MacroAttribute, dummy_spanned};
+use codemap::{self, SourceMap, ExpnInfo, MacroAttribute, dummy_spanned};
 use errors;
 use config;
 use entry::{self, EntryPointType};
diff --git a/src/libsyntax/test_snippet.rs b/src/libsyntax/test_snippet.rs
index c7e4fbd1073..12f72a3979e 100644
--- a/src/libsyntax/test_snippet.rs
+++ b/src/libsyntax/test_snippet.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use codemap::{CodeMap, FilePathMapping};
+use codemap::{SourceMap, FilePathMapping};
 use errors::Handler;
 use errors::emitter::EmitterWriter;
 use std::io;
@@ -50,7 +50,7 @@ fn test_harness(file_text: &str, span_labels: Vec<SpanLabel>, expected_output: &
     with_globals(|| {
         let output = Arc::new(Mutex::new(Vec::new()));
 
-        let code_map = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+        let code_map = Lrc::new(SourceMap::new(FilePathMapping::empty()));
         code_map.new_filemap(Path::new("test.rs").to_owned().into(), file_text.to_owned());
 
         let primary_span = make_span(&file_text, &span_labels[0].start, &span_labels[0].end);