]> git.lizzy.rs Git - rust.git/commitdiff
mv CodeMap SourceMap
authorDonato Sciarra <sciarp@gmail.com>
Sat, 18 Aug 2018 10:13:35 +0000 (12:13 +0200)
committerDonato Sciarra <sciarp@gmail.com>
Sun, 19 Aug 2018 21:00:59 +0000 (23:00 +0200)
28 files changed:
src/librustc/hir/map/collector.rs
src/librustc/hir/map/definitions.rs
src/librustc/hir/print.rs
src/librustc/ich/caching_codemap_view.rs
src/librustc/ich/hcx.rs
src/librustc/session/mod.rs
src/librustc/ty/query/on_disk_cache.rs
src/librustc_driver/lib.rs
src/librustc_driver/test.rs
src/librustc_errors/emitter.rs
src/librustc_errors/lib.rs
src/librustc_metadata/decoder.rs
src/librustc_resolve/lib.rs
src/librustc_typeck/check/demand.rs
src/librustdoc/core.rs
src/librustdoc/html/highlight.rs
src/librustdoc/test.rs
src/libsyntax/codemap.rs
src/libsyntax/ext/base.rs
src/libsyntax/json.rs
src/libsyntax/parse/lexer/comments.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/mod.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pprust.rs
src/libsyntax/test.rs
src/libsyntax/test_snippet.rs
src/libsyntax_pos/lib.rs

index 3934475bea90c88c8d65212f9a607a1fe6022b09..ceeb31934e16aad7cf0679a88837926df26ddb9d 100644 (file)
@@ -18,7 +18,7 @@
 use session::CrateDisambiguator;
 use std::iter::repeat;
 use syntax::ast::{NodeId, CRATE_NODE_ID};
-use syntax::codemap::CodeMap;
+use syntax::codemap::SourceMap;
 use syntax_pos::Span;
 
 use ich::StableHashingContext;
@@ -122,7 +122,7 @@ pub(super) fn root(krate: &'hir Crate,
     pub(super) fn finalize_and_compute_crate_hash(mut self,
                                                   crate_disambiguator: CrateDisambiguator,
                                                   cstore: &dyn CrateStore,
-                                                  codemap: &CodeMap,
+                                                  codemap: &SourceMap,
                                                   commandline_args_hash: u64)
                                                   -> (Vec<MapEntry<'hir>>, Svh) {
         self
index c4b28fe2c4332ad5b1a077f48128f271ce9675d6..7ecbf7ebbaff07f63520365a79e33fee18ed05db 100644 (file)
@@ -739,7 +739,7 @@ fn name(&self) -> Symbol {
     LangItems,
     LangItemsMissing,
     NativeLibraries,
-    CodeMap,
+    SourceMap,
     Impls,
     ExportedSymbols
 });
index 4499a378be21a928a435fefcc00588186c2511c1..512f78763b27383003732f0e99c1fb52b8070911 100644 (file)
@@ -12,7 +12,7 @@
 
 use rustc_target::spec::abi::Abi;
 use syntax::ast;
-use syntax::codemap::{CodeMap, Spanned};
+use syntax::codemap::{SourceMap, Spanned};
 use syntax::parse::ParseSess;
 use syntax::parse::lexer::comments;
 use syntax::print::pp::{self, Breaks};
@@ -85,7 +85,7 @@ fn nested(&self, state: &mut State, nested: Nested) -> io::Result<()> {
 
 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,
@@ -129,7 +129,7 @@ fn bump_lit(&mut self) -> Option<comments::Literal> {
 /// 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: &hir::Crate,
                        filename: FileName,
@@ -149,7 +149,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,
@@ -173,7 +173,7 @@ pub fn new_from_input(cm: &'a CodeMap,
                    })
     }
 
-    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>>,
index e5bf384d253c526c386455bd52907f789d5952f2..769c4cfe9fa9386563569bfd1343ab1c46250a5d 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use rustc_data_structures::sync::Lrc;
-use syntax::codemap::CodeMap;
+use syntax::codemap::SourceMap;
 use syntax_pos::{BytePos, FileMap};
 
 #[derive(Clone)]
@@ -24,13 +24,13 @@ struct CacheEntry {
 
 #[derive(Clone)]
 pub struct CachingCodemapView<'cm> {
-    codemap: &'cm CodeMap,
+    codemap: &'cm SourceMap,
     line_cache: [CacheEntry; 3],
     time_stamp: usize,
 }
 
 impl<'cm> CachingCodemapView<'cm> {
-    pub fn new(codemap: &'cm CodeMap) -> CachingCodemapView<'cm> {
+    pub fn new(codemap: &'cm SourceMap) -> CachingCodemapView<'cm> {
         let files = codemap.files();
         let first_file = files[0].clone();
         let entry = CacheEntry {
index 329cc2216a498105a7d8bc20f04499b34070281f..91fbb1cc0fde6107748cedcf6fc367af409f10ed 100644 (file)
@@ -25,7 +25,7 @@
 
 use syntax::ast;
 
-use syntax::codemap::CodeMap;
+use syntax::codemap::SourceMap;
 use syntax::ext::hygiene::SyntaxContext;
 use syntax::symbol::Symbol;
 use syntax_pos::{Span, DUMMY_SP};
@@ -58,7 +58,7 @@ pub struct StableHashingContext<'a> {
 
     // Very often, we are hashing something that does not need the
     // CachingCodemapView, so we initialize it lazily.
-    raw_codemap: &'a CodeMap,
+    raw_codemap: &'a SourceMap,
     caching_codemap: Option<CachingCodemapView<'a>>,
 
     pub(super) alloc_id_recursion_tracker: FxHashSet<AllocId>,
@@ -308,9 +308,9 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
 
     // Hash a span in a stable way. We can't directly hash the span's BytePos
     // fields (that would be similar to hashing pointers, since those are just
-    // offsets into the CodeMap). Instead, we hash the (file name, line, column)
+    // offsets into the SourceMap). Instead, we hash the (file name, line, column)
     // triple, which stays the same even if the containing FileMap has moved
-    // within the CodeMap.
+    // within the SourceMap.
     // Also note that we are hashing byte offsets for the column, not unicode
     // codepoint offsets. For the purpose of the hash that's sufficient.
     // Also, hashing filenames is expensive so we avoid doing it twice when the
index 3dc697e6adb5b6b8be917ffa293370be2f3cf998..05f8e3cfb00ac9ab24416aec56e1a6fbd069cd4a 100644 (file)
@@ -484,7 +484,7 @@ pub fn diag_span_suggestion_once<'a, 'b>(
         );
     }
 
-    pub fn codemap<'a>(&'a self) -> &'a codemap::CodeMap {
+    pub fn codemap<'a>(&'a self) -> &'a codemap::SourceMap {
         self.parse_sess.codemap()
     }
     pub fn verbose(&self) -> bool {
@@ -984,7 +984,7 @@ pub fn build_session(
         sopts,
         local_crate_source_file,
         registry,
-        Lrc::new(codemap::CodeMap::new(file_path_mapping)),
+        Lrc::new(codemap::SourceMap::new(file_path_mapping)),
         None,
     )
 }
@@ -993,7 +993,7 @@ pub fn build_session_with_codemap(
     sopts: config::Options,
     local_crate_source_file: Option<PathBuf>,
     registry: errors::registry::Registry,
-    codemap: Lrc<codemap::CodeMap>,
+    codemap: Lrc<codemap::SourceMap>,
     emitter_dest: Option<Box<dyn Write + Send>>,
 ) -> Session {
     // FIXME: This is not general enough to make the warning lint completely override
@@ -1070,7 +1070,7 @@ pub fn build_session_(
     sopts: config::Options,
     local_crate_source_file: Option<PathBuf>,
     span_diagnostic: errors::Handler,
-    codemap: Lrc<codemap::CodeMap>,
+    codemap: Lrc<codemap::SourceMap>,
 ) -> Session {
     let host_triple = TargetTriple::from_triple(config::host_triple());
     let host = match Target::search(&host_triple) {
index aa42b4072bd8a62a98c3b4420593b92b207bf248..1f0f6bee77795b6d7049a7d686b04a8b75faf3f0 100644 (file)
@@ -26,7 +26,7 @@
 use session::{CrateDisambiguator, Session};
 use std::mem;
 use syntax::ast::NodeId;
-use syntax::codemap::{CodeMap, StableFilemapId};
+use syntax::codemap::{SourceMap, StableFilemapId};
 use syntax_pos::{BytePos, Span, DUMMY_SP, FileMap};
 use syntax_pos::hygiene::{Mark, SyntaxContext, ExpnInfo};
 use ty;
@@ -62,7 +62,7 @@ pub struct OnDiskCache<'sess> {
     prev_cnums: Vec<(u32, String, CrateDisambiguator)>,
     cnum_map: Once<IndexVec<CrateNum, Option<CrateNum>>>,
 
-    codemap: &'sess CodeMap,
+    codemap: &'sess SourceMap,
     file_index_to_stable_id: FxHashMap<FileMapIndex, StableFilemapId>,
 
     // These two fields caches that are populated lazily during decoding.
@@ -149,7 +149,7 @@ pub fn new(sess: &'sess Session, data: Vec<u8>, start_pos: usize) -> OnDiskCache
         }
     }
 
-    pub fn new_empty(codemap: &'sess CodeMap) -> OnDiskCache<'sess> {
+    pub fn new_empty(codemap: &'sess SourceMap) -> OnDiskCache<'sess> {
         OnDiskCache {
             serialized_data: Vec::new(),
             file_index_to_stable_id: FxHashMap(),
@@ -475,7 +475,7 @@ fn compute_cnum_map(tcx: TyCtxt,
 struct CacheDecoder<'a, 'tcx: 'a, 'x> {
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     opaque: opaque::Decoder<'x>,
-    codemap: &'x CodeMap,
+    codemap: &'x SourceMap,
     cnum_map: &'x IndexVec<CrateNum, Option<CrateNum>>,
     synthetic_expansion_infos: &'x Lock<FxHashMap<AbsoluteBytePos, SyntaxContext>>,
     file_index_to_file: &'x Lock<FxHashMap<FileMapIndex, Lrc<FileMap>>>,
index d25d57a004b5f64eeb6c6c25174ca2410a7ed71d..ed6e9db5e4e512f65b72989613d7da72a35b9219 100644 (file)
 use std::thread;
 
 use syntax::ast;
-use syntax::codemap::{CodeMap, FileLoader, RealFileLoader};
+use syntax::codemap::{SourceMap, FileLoader, RealFileLoader};
 use syntax::feature_gate::{GatedCfg, UnstableFeatures};
 use syntax::parse::{self, PResult};
 use syntax_pos::{DUMMY_SP, MultiSpan, FileName};
@@ -522,7 +522,7 @@ macro_rules! do_or_return {($expr: expr, $sess: expr) => {
     };
 
     let loader = file_loader.unwrap_or(box RealFileLoader);
-    let codemap = Lrc::new(CodeMap::with_file_loader(loader, sopts.file_path_mapping()));
+    let codemap = Lrc::new(SourceMap::with_file_loader(loader, sopts.file_path_mapping()));
     let mut sess = session::build_session_with_codemap(
         sopts, input_file_path.clone(), descriptions, codemap, emitter_dest,
     );
index 03651322bc9806ae7dceacd35ca0aa2bb4bdc771..a4bba31b669c7f548fd7ba2786f66b15fadba5ca 100644 (file)
@@ -32,7 +32,7 @@
 use syntax;
 use syntax::ast;
 use rustc_target::spec::abi::Abi;
-use syntax::codemap::{CodeMap, FilePathMapping, FileName};
+use syntax::codemap::{SourceMap, FilePathMapping, FileName};
 use errors;
 use errors::emitter::Emitter;
 use errors::{Level, DiagnosticBuilder};
@@ -121,7 +121,7 @@ fn test_env_with_pool<F>(
     let sess = session::build_session_(options,
                                        None,
                                        diagnostic_handler,
-                                       Lrc::new(CodeMap::new(FilePathMapping::empty())));
+                                       Lrc::new(SourceMap::new(FilePathMapping::empty())));
     let cstore = CStore::new(::get_codegen_backend(&sess).metadata_loader());
     rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
     let input = config::Input::Str {
index 6b1298750fba0533fd44735d8dc0688a3972e32f..0a3e4d3ad25c0c555244f1cdaff06feefb052884 100644 (file)
@@ -12,7 +12,7 @@
 
 use syntax_pos::{FileMap, Span, MultiSpan};
 
-use {Level, CodeSuggestion, DiagnosticBuilder, SubDiagnostic, CodeMapperDyn, DiagnosticId};
+use {Level, CodeSuggestion, DiagnosticBuilder, SubDiagnostic, SourceMapperDyn, DiagnosticId};
 use snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, StyledString, Style};
 use styled_buffer::StyledBuffer;
 
@@ -120,7 +120,7 @@ fn to_color_choice(&self) -> ColorChoice {
 
 pub struct EmitterWriter {
     dst: Destination,
-    cm: Option<Lrc<CodeMapperDyn>>,
+    cm: Option<Lrc<SourceMapperDyn>>,
     short_message: bool,
     teach: bool,
     ui_testing: bool,
@@ -134,7 +134,7 @@ struct FileWithAnnotatedLines {
 
 impl EmitterWriter {
     pub fn stderr(color_config: ColorConfig,
-                  code_map: Option<Lrc<CodeMapperDyn>>,
+                  code_map: Option<Lrc<SourceMapperDyn>>,
                   short_message: bool,
                   teach: bool)
                   -> EmitterWriter {
@@ -149,7 +149,7 @@ pub fn stderr(color_config: ColorConfig,
     }
 
     pub fn new(dst: Box<dyn Write + Send>,
-               code_map: Option<Lrc<CodeMapperDyn>>,
+               code_map: Option<Lrc<SourceMapperDyn>>,
                short_message: bool,
                teach: bool)
                -> EmitterWriter {
index 1666369e422cadc5c7a02c06ddf31771fde237a2..40d7a122d3091d214e723b7a4e3216423321c8fb 100644 (file)
@@ -111,9 +111,9 @@ pub struct SubstitutionPart {
     pub snippet: String,
 }
 
-pub type CodeMapperDyn = dyn CodeMapper + sync::Send + sync::Sync;
+pub type SourceMapperDyn = dyn SourceMapper + sync::Send + sync::Sync;
 
-pub trait CodeMapper {
+pub trait SourceMapper {
     fn lookup_char_pos(&self, pos: BytePos) -> Loc;
     fn span_to_lines(&self, sp: Span) -> FileLinesResult;
     fn span_to_string(&self, sp: Span) -> String;
@@ -126,7 +126,7 @@ pub trait CodeMapper {
 
 impl CodeSuggestion {
     /// Returns the assembled code suggestions and whether they should be shown with an underline.
-    pub fn splice_lines(&self, cm: &CodeMapperDyn)
+    pub fn splice_lines(&self, cm: &SourceMapperDyn)
                         -> Vec<(String, Vec<SubstitutionPart>)> {
         use syntax_pos::{CharPos, Loc, Pos};
 
@@ -321,7 +321,7 @@ impl Handler {
     pub fn with_tty_emitter(color_config: ColorConfig,
                             can_emit_warnings: bool,
                             treat_err_as_bug: bool,
-                            cm: Option<Lrc<CodeMapperDyn>>)
+                            cm: Option<Lrc<SourceMapperDyn>>)
                             -> Handler {
         Handler::with_tty_emitter_and_flags(
             color_config,
@@ -334,7 +334,7 @@ pub fn with_tty_emitter(color_config: ColorConfig,
     }
 
     pub fn with_tty_emitter_and_flags(color_config: ColorConfig,
-                                      cm: Option<Lrc<CodeMapperDyn>>,
+                                      cm: Option<Lrc<SourceMapperDyn>>,
                                       flags: HandlerFlags)
                                       -> Handler {
         let emitter = Box::new(EmitterWriter::stderr(color_config, cm, false, false));
index 33d4cf26c039551a5e0c8e5b66bd97e8716b5ad6..4a17c5845fdb4a7b4c76065e2565e2191e51814f 100644 (file)
@@ -1117,7 +1117,7 @@ pub fn def_path_hash(&self, index: DefIndex) -> DefPathHash {
     /// multibyte characters. This information is enough to generate valid debuginfo
     /// for items inlined from other crates.
     pub fn imported_filemaps(&'a self,
-                             local_codemap: &codemap::CodeMap)
+                             local_codemap: &codemap::SourceMap)
                              -> ReadGuard<'a, Vec<cstore::ImportedFileMap>> {
         {
             let filemaps = self.codemap_import_info.borrow();
@@ -1154,7 +1154,7 @@ pub fn imported_filemaps(&'a self,
 
             // Translate line-start positions and multibyte character
             // position into frame of reference local to file.
-            // `CodeMap::new_imported_filemap()` will then translate those
+            // `SourceMap::new_imported_filemap()` will then translate those
             // coordinates to their new global frame of reference when the
             // offset of the FileMap is known.
             for pos in &mut lines {
index 2e163cb4c6a37006c9cc7e009aecefc5f781121f..0356bdae7dc341c96a85c9d7b6e4631b65b95c1f 100644 (file)
@@ -49,7 +49,7 @@
 use rustc_metadata::creader::CrateLoader;
 use rustc_metadata::cstore::CStore;
 
-use syntax::codemap::CodeMap;
+use syntax::codemap::SourceMap;
 use syntax::ext::hygiene::{Mark, Transparency, SyntaxContext};
 use syntax::ast::{self, Name, NodeId, Ident, FloatTy, IntTy, UintTy};
 use syntax::ext::base::SyntaxExtension;
@@ -415,7 +415,7 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
 /// Attention: The method used is very fragile since it essentially duplicates the work of the
 /// parser. If you need to use this function or something similar, please consider updating the
 /// codemap functions and this function to something more robust.
-fn reduce_impl_span_to_impl_keyword(cm: &CodeMap, impl_span: Span) -> Span {
+fn reduce_impl_span_to_impl_keyword(cm: &SourceMap, impl_span: Span) -> Span {
     let impl_span = cm.span_until_char(impl_span, '<');
     let impl_span = cm.span_until_whitespace(impl_span);
     impl_span
index 92b35bd50f3c37b2fb57865a641e536ec8f6fc56..8bd53976e264c48563e9e8b1b40ff9ba8c49fd06 100644 (file)
@@ -21,7 +21,7 @@
 use rustc::hir::{Item, ItemKind, print};
 use rustc::ty::{self, Ty, AssociatedItem};
 use rustc::ty::adjustment::AllowTwoPhase;
-use errors::{DiagnosticBuilder, CodeMapper};
+use errors::{DiagnosticBuilder, SourceMapper};
 
 use super::method::probe;
 
index 68e4618328077cc6030e309c031703c4ed14186b..6b2cb53b8f1f05f5cc3eaa05729b8ac78da600c8 100644 (file)
@@ -258,9 +258,9 @@ fn is_doc_reachable(&self, did: DefId) -> bool {
 
 /// Creates a new diagnostic `Handler` that can be used to emit warnings and errors.
 ///
-/// If the given `error_format` is `ErrorOutputType::Json` and no `CodeMap` is given, a new one
+/// If the given `error_format` is `ErrorOutputType::Json` and no `SourceMap` is given, a new one
 /// will be created for the handler.
-pub fn new_handler(error_format: ErrorOutputType, codemap: Option<Lrc<codemap::CodeMap>>)
+pub fn new_handler(error_format: ErrorOutputType, codemap: Option<Lrc<codemap::SourceMap>>)
     -> errors::Handler
 {
     // rustdoc doesn't override (or allow to override) anything from this that is relevant here, so
@@ -277,7 +277,7 @@ pub fn new_handler(error_format: ErrorOutputType, codemap: Option<Lrc<codemap::C
         ),
         ErrorOutputType::Json(pretty) => {
             let codemap = codemap.unwrap_or_else(
-                || Lrc::new(codemap::CodeMap::new(sessopts.file_path_mapping())));
+                || Lrc::new(codemap::SourceMap::new(sessopts.file_path_mapping())));
             Box::new(
                 JsonEmitter::stderr(
                     None,
@@ -387,7 +387,7 @@ pub fn run_core(search_paths: SearchPaths,
         ..Options::default()
     };
     driver::spawn_thread_pool(sessopts, move |sessopts| {
-        let codemap = Lrc::new(codemap::CodeMap::new(sessopts.file_path_mapping()));
+        let codemap = Lrc::new(codemap::SourceMap::new(sessopts.file_path_mapping()));
         let diagnostic_handler = new_handler(error_format, Some(codemap.clone()));
 
         let mut sess = session::build_session_(
index ff2cc35fce807622012c1ddac4ef177d24704b62..a913700911507dfd2d632089f461d876a9b6598c 100644 (file)
@@ -21,7 +21,7 @@
 use std::io;
 use std::io::prelude::*;
 
-use syntax::codemap::{CodeMap, FilePathMapping};
+use syntax::codemap::{SourceMap, FilePathMapping};
 use syntax::parse::lexer::{self, TokenAndSpan};
 use syntax::parse::token;
 use syntax::parse;
@@ -60,7 +60,7 @@ pub fn render_with_highlighting(src: &str, class: Option<&str>,
 /// each span of text in sequence.
 struct Classifier<'a> {
     lexer: lexer::StringReader<'a>,
-    codemap: &'a CodeMap,
+    codemap: &'a SourceMap,
 
     // State of the classifier.
     in_attribute: bool,
@@ -145,7 +145,7 @@ fn exit_span(&mut self) -> io::Result<()> {
 }
 
 impl<'a> Classifier<'a> {
-    fn new(lexer: lexer::StringReader<'a>, codemap: &'a CodeMap) -> Classifier<'a> {
+    fn new(lexer: lexer::StringReader<'a>, codemap: &'a SourceMap) -> Classifier<'a> {
         Classifier {
             lexer,
             codemap,
index 569815c833adaa533fad4dfee5143cbd959a01e0..605b08219a14888dff19422a5f40ecb54bc970a5 100644 (file)
@@ -33,7 +33,7 @@
 use rustc_metadata::cstore::CStore;
 use rustc_resolve::MakeGlobMap;
 use syntax::ast;
-use syntax::codemap::CodeMap;
+use syntax::codemap::SourceMap;
 use syntax::edition::Edition;
 use syntax::feature_gate::UnstableFeatures;
 use syntax::with_globals;
@@ -86,7 +86,7 @@ pub fn run(input_path: &Path,
         ..config::Options::default()
     };
     driver::spawn_thread_pool(sessopts, |sessopts| {
-        let codemap = Lrc::new(CodeMap::new(sessopts.file_path_mapping()));
+        let codemap = Lrc::new(SourceMap::new(sessopts.file_path_mapping()));
         let handler =
             errors::Handler::with_tty_emitter(ColorConfig::Auto,
                                             true, false,
@@ -205,7 +205,7 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
     // never wrap the test in `fn main() { ... }`
     let (test, line_offset) = make_test(test, Some(cratename), as_test_harness, opts);
     // FIXME(#44940): if doctests ever support path remapping, then this filename
-    // needs to be the result of CodeMap::span_to_unmapped_path
+    // needs to be the result of SourceMap::span_to_unmapped_path
     let input = config::Input::Str {
         name: filename.to_owned(),
         input: test.to_owned(),
@@ -262,7 +262,7 @@ fn drop(&mut self) {
     let _bomb = Bomb(data.clone(), old.unwrap_or(box io::stdout()));
 
     let (libdir, outdir, compile_result) = driver::spawn_thread_pool(sessopts, |sessopts| {
-        let codemap = Lrc::new(CodeMap::new_doctest(
+        let codemap = Lrc::new(SourceMap::new_doctest(
             sessopts.file_path_mapping(), filename.clone(), line as isize - line_offset as isize
         ));
         let emitter = errors::emitter::EmitterWriter::new(box Sink(data.clone()),
@@ -500,7 +500,7 @@ pub struct Collector {
     opts: TestOptions,
     maybe_sysroot: Option<PathBuf>,
     position: Span,
-    codemap: Option<Lrc<CodeMap>>,
+    codemap: Option<Lrc<SourceMap>>,
     filename: Option<PathBuf>,
     linker: Option<PathBuf>,
     edition: Edition,
@@ -509,7 +509,7 @@ pub struct Collector {
 impl Collector {
     pub fn new(cratename: String, cfgs: Vec<String>, libs: SearchPaths, cg: CodegenOptions,
                externs: Externs, use_headers: bool, opts: TestOptions,
-               maybe_sysroot: Option<PathBuf>, codemap: Option<Lrc<CodeMap>>,
+               maybe_sysroot: Option<PathBuf>, codemap: Option<Lrc<SourceMap>>,
                filename: Option<PathBuf>, linker: Option<PathBuf>, edition: Edition) -> Collector {
         Collector {
             tests: Vec::new(),
index 0a9991d33b186c5a98bd2d5757f1af3662bd61fc..8175e2495c5d17e382392abcf8c9255fdfca699d 100644 (file)
@@ -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::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 @@ pub fn new(filemap: &FileMap) -> 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 @@ pub fn new(path_mapping: FilePathMapping) -> 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 @@ pub fn span_to_filename(&self, sp: Span) -> FileName {
 
     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 @@ pub fn generate_local_type_param_snippet(&self, span: Span) -> Option<(Span, Str
     }
 }
 
-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 @@ fn t5() {
         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 @@ fn span_from_selection(input: &str, selection: &str) -> Span {
     /// 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 @@ fn t9() {
     /// 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 @@ fn span_merging_fail() {
 
     /// 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 @@ fn span_substr(&self,
                     -> Span;
     }
 
-    impl CodeMapExtension for CodeMap {
+    impl SourceMapExtension for SourceMap {
         fn span_substr(&self,
                     file: &Lrc<FileMap>,
                     source_text: &str,
index 482d8c2cf9866a390979abaf2e573e6fb1ce55fc..8ae4f9c1aa46f6da07ed6d15495daaef371731e0 100644 (file)
@@ -12,7 +12,7 @@
 
 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 @@ pub fn monotonic_expander<'b>(&'b mut self) -> expand::MacroExpander<'b, '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 {
index 65de1503966bfdc2020aa1aceecc64be687e2a66..22de184938f0cb9f4ad4d468bee1eb1ec6c0dd66 100644 (file)
 
 // 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};
 
 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 @@ pub fn stderr(registry: Option<Registry>,
 
     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,
index 2c53dbdc402a5b2c415919adb12382a10d9efd5e..2c227756f9a31fb14cdd9ab2b9c05f6037f5fcb6 100644 (file)
@@ -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);
 
index bdf25618f474eda00f8d2bb87dab4604b86718f0..c1919434e374a87ab398e51df1eb7202b30a0622 100644 (file)
@@ -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 @@ fn scan_comment(&mut self) -> Option<TokenAndSpan> {
 
                 // 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 @@ fn mk_sess(cm: Lrc<CodeMap>) -> ParseSess {
     }
 
     // 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 @@ fn setup<'a>(cm: &CodeMap,
     #[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 @@ fn mk_ident(id: &str) -> token::Token {
     #[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 @@ fn doublecolonparsing() {
     #[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 @@ fn dcparsing_2() {
     #[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 @@ fn dcparsing_3() {
     #[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 @@ fn dcparsing_4() {
     #[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 @@ fn character_a() {
     #[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 @@ fn character_space() {
     #[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 @@ fn character_escaped() {
     #[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 @@ fn lifetime_name() {
     #[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 @@ fn raw_string() {
     #[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 @@ fn line_doc_comments() {
     #[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 @@ fn nested_block_comments() {
     #[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();
index d029509f0c12d1bac578c6b918ebbebbc424b379..d43cbf38064e2a1797128b74c241cee955e2980d 100644 (file)
@@ -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 @@ pub fn new(file_path_mapping: FilePathMapping) -> Self {
         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 @@ pub fn with_span_handler(handler: Handler, code_map: Lrc<CodeMap>) -> ParseSess
         }
     }
 
-    pub fn codemap(&self) -> &CodeMap {
+    pub fn codemap(&self) -> &SourceMap {
         &self.code_map
     }
 
index 345464c66642570e2e39a6d22358f54192c5b5f8..1e6c1eee4835a133c0d8771b31d666a5b16e2a33 100644 (file)
@@ -42,7 +42,7 @@
 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 @@ pub fn default_submod_path(
         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
index 54ce06f61ef6b18654c534cfe3c47d976da1e7bf..2646d52b739862878a6b6a71d0b67cec64dbc6e4 100644 (file)
@@ -16,7 +16,7 @@
 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 @@ fn rust_printer<'a>(writer: Box<dyn Write+'a>, ann: &'a dyn PpAnn) -> State<'a>
 /// 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 @@ pub fn new_from_input(cm: &'a CodeMap,
             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>>,
index 1cbaf3cc312b7c66b0ec67677e70d4d3ca44fd9b..633de812a87a07f19f2a0dbdbc0ce207a222bae7 100644 (file)
@@ -22,7 +22,7 @@
 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};
index c7e4fbd1073d7c06cb8657c0cd12f4d0b07a2b54..12f72a3979e0144738ee8e25384eb00585049366 100644 (file)
@@ -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);
index 98d7d77308f89e78ce6204e777a8c1d232d78f12..fec7551a208c6de9a33cea81dbf7dec17bce332d 100644 (file)
@@ -163,7 +163,7 @@ pub fn is_macros(&self) -> bool {
 
 /// Spans represent a region of code, used for error reporting. Positions in spans
 /// are *absolute* positions from the beginning of the codemap, not positions
-/// relative to FileMaps. Methods on the CodeMap can be used to relate spans back
+/// relative to FileMaps. Methods on the SourceMap can be used to relate spans back
 /// to the original source.
 /// You must be careful if the span crosses more than one file - you will not be
 /// able to use many of the functions on spans in codemap and you cannot assume
@@ -678,7 +678,7 @@ fn from(spans: Vec<Span>) -> MultiSpan {
 /// Identifies an offset of a multi-byte character in a FileMap
 #[derive(Copy, Clone, RustcEncodable, RustcDecodable, Eq, PartialEq, Debug)]
 pub struct MultiByteChar {
-    /// The absolute offset of the character in the CodeMap
+    /// The absolute offset of the character in the SourceMap
     pub pos: BytePos,
     /// The number of bytes, >=2
     pub bytes: u8,
@@ -705,7 +705,7 @@ fn new(pos: BytePos, width: usize) -> Self {
         }
     }
 
-    /// Returns the absolute offset of the character in the CodeMap
+    /// Returns the absolute offset of the character in the SourceMap
     pub fn pos(&self) -> BytePos {
         match *self {
             NonNarrowChar::ZeroWidth(p) |
@@ -777,7 +777,7 @@ pub fn get_source(&self) -> Option<&str> {
     }
 }
 
-/// A single source in the CodeMap.
+/// A single source in the SourceMap.
 #[derive(Clone)]
 pub struct FileMap {
     /// The name of the file that the source came from, source that doesn't
@@ -798,9 +798,9 @@ pub struct FileMap {
     /// The external source code (used for external crates, which will have a `None`
     /// value as `self.src`.
     pub external_src: Lock<ExternalSource>,
-    /// The start position of this source in the CodeMap
+    /// The start position of this source in the SourceMap
     pub start_pos: BytePos,
-    /// The end position of this source in the CodeMap
+    /// The end position of this source in the SourceMap
     pub end_pos: BytePos,
     /// Locations of lines beginnings in the source code
     pub lines: Vec<BytePos>,
@@ -1141,7 +1141,7 @@ pub trait Pos {
 pub struct BytePos(pub u32);
 
 /// A character offset. Because of multibyte utf8 characters, a byte offset
-/// is not equivalent to a character offset. The CodeMap will convert BytePos
+/// is not equivalent to a character offset. The SourceMap will convert BytePos
 /// values to CharPos values as necessary.
 #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)]
 pub struct CharPos(pub usize);