about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorSébastien Duquette <ekse.0x@gmail.com>2018-08-23 00:13:02 -0400
committerWho? Me?! <mark-i-m@users.noreply.github.com>2018-08-23 21:56:35 -0500
commit6ebc0cd09bcc3f9e5fa76ba7de689f3914a444d1 (patch)
treebea7d3b5946bde14bb955b94d04020fd765ba52d /src/doc
parent32fe7bd6d2430727ae459464178cd0e14e68fcb5 (diff)
downloadrust-6ebc0cd09bcc3f9e5fa76ba7de689f3914a444d1.tar.gz
rust-6ebc0cd09bcc3f9e5fa76ba7de689f3914a444d1.zip
Rename CodeMap and FileMap to SourceMap and SourceFile.
Those types were renamed in https://github.com/rust-lang/rust/pull/52953
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/rustc-dev-guide/src/appendix/code-index.md4
-rw-r--r--src/doc/rustc-dev-guide/src/diag.md16
-rw-r--r--src/doc/rustc-dev-guide/src/rustc-driver.md4
-rw-r--r--src/doc/rustc-dev-guide/src/the-parser.md10
4 files changed, 17 insertions, 17 deletions
diff --git a/src/doc/rustc-dev-guide/src/appendix/code-index.md b/src/doc/rustc-dev-guide/src/appendix/code-index.md
index b6986c5c0a8..140b182b197 100644
--- a/src/doc/rustc-dev-guide/src/appendix/code-index.md
+++ b/src/doc/rustc-dev-guide/src/appendix/code-index.md
@@ -7,20 +7,20 @@ compiler.
 Item            |  Kind    | Short description           | Chapter            | Declaration
 ----------------|----------|-----------------------------|--------------------|-------------------
 `BodyId` | struct | One of four types of HIR node identifiers | [Identifiers in the HIR] | [src/librustc/hir/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/hir/struct.BodyId.html)
-`CodeMap` | struct | Maps AST nodes to their source code. It is composed of `FileMap`s | [The parser] | [src/libsyntax/codemap.rs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/codemap/struct.CodeMap.html)
 `CompileState` | struct | State that is passed to a callback at each compiler pass | [The Rustc Driver] | [src/librustc_driver/driver.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/driver/struct.CompileState.html)
 `ast::Crate` | struct | A syntax-level representation of a parsed crate | [The parser] | [src/librustc/hir/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/ast/struct.Crate.html)
 `hir::Crate` | struct | A more abstract, compiler-friendly form of a crate's AST | [The Hir] | [src/librustc/hir/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/hir/struct.Crate.html)
 `DefId` | struct | One of four types of HIR node identifiers | [Identifiers in the HIR] | [src/librustc/hir/def_id.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/hir/def_id/struct.DefId.html)
 `DiagnosticBuilder` | struct | A struct for building up compiler diagnostics, such as errors or lints | [Emitting Diagnostics] | [src/librustc_errors/diagnostic_builder.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.DiagnosticBuilder.html)
 `DocContext` | struct | A state container used by rustdoc when crawling through a crate to gather its documentation | [Rustdoc] | [src/librustdoc/core.rs](https://github.com/rust-lang/rust/blob/master/src/librustdoc/core.rs)
-`FileMap` | struct | Part of the `CodeMap`. Maps AST nodes to their source code for a single source file | [The parser] | [src/libsyntax_pos/lib.rs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/codemap/struct.FileMap.html)
 `HirId` | struct | One of four types of HIR node identifiers | [Identifiers in the HIR] | [src/librustc/hir/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/hir/struct.HirId.html)
 `NodeId` | struct | One of four types of HIR node identifiers. Being phased out | [Identifiers in the HIR] | [src/libsyntax/ast.rs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/ast/struct.NodeId.html)
 `ParamEnv` | struct | Information about generic parameters or `Self`, useful for working with associated or generic items | [Parameter Environment] | [src/librustc/ty/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/struct.ParamEnv.html)
 `ParseSess` | struct | This struct contains information about a parsing session | [The parser] | [src/libsyntax/parse/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/parse/struct.ParseSess.html)
 `Rib` | struct | Represents a single scope of names | [Name resolution] | [src/librustc_resolve/lib.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_resolve/struct.Rib.html)
 `Session` | struct | The data associated with a compilation session | [The parser], [The Rustc Driver] | [src/librustc/session/mod.html](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/session/struct.Session.html)
+`SourceFile` | struct | Part of the `SourceMap`. Maps AST nodes to their source code for a single source file | [The parser] | [src/libsyntax_pos/lib.rs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/source_map/struct.SourceFile.html)
+`SourceMap` | struct | Maps AST nodes to their source code. It is composed of `SourceFile`s | [The parser] | [src/libsyntax/source_map.rs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/source_map/struct.SourceMap.html)
 `Span` | struct  | A location in the user's source code, used for error reporting primarily | [Emitting Diagnostics] | [src/libsyntax_pos/span_encoding.rs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax_pos/struct.Span.html)
 `StringReader` | struct | This is the lexer used during parsing. It consumes characters from the raw source code being compiled and produces a series of tokens for use by the rest of the parser | [The parser] |  [src/libsyntax/parse/lexer/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/parse/lexer/struct.StringReader.html)
 `syntax::token_stream::TokenStream` | struct | An abstract sequence of tokens, organized into `TokenTree`s | [The parser], [Macro expansion] | [src/libsyntax/tokenstream.rs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/tokenstream/struct.TokenStream.html)
diff --git a/src/doc/rustc-dev-guide/src/diag.md b/src/doc/rustc-dev-guide/src/diag.md
index 3690d615277..3d9a6fc37e9 100644
--- a/src/doc/rustc-dev-guide/src/diag.md
+++ b/src/doc/rustc-dev-guide/src/diag.md
@@ -9,14 +9,14 @@ This chapter is about how to emit compile errors and lints from the compiler.
 location in the code being compiled. `Span`s are attached to most constructs in
 HIR and MIR, allowing for more informative error reporting.
 
-[span]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/codemap/struct.Span.html
+[span]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/source_map/struct.Span.html
 
-A `Span` can be looked up in a [`CodeMap`][codemap] to get a "snippet" useful
+A `Span` can be looked up in a [`SourceMap`][sourcemap] to get a "snippet" useful
 for displaying errors with [`span_to_snippet`][sptosnip] and other similar
-methods on the `CodeMap`.
+methods on the `SourceMap`.
 
-[codemap]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/codemap/struct.CodeMap.html
-[sptosnip]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/codemap/struct.CodeMap.html#method.span_to_snippet
+[sourcemap]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/source_map/struct.SourceMap.html
+[sptosnip]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/source_map/struct.SourceMap.html#method.span_to_snippet
 
 ## Error messages
 
@@ -58,7 +58,7 @@ let mut err = sess.struct_span_err(sp, "oh no! this is an error!");
 // In some cases, you might need to check if `sp` is generated by a macro to
 // avoid printing weird errors about macro-generated code.
 
-if let Ok(snippet) = sess.codemap().span_to_snippet(sp) {
+if let Ok(snippet) = sess.source_map().span_to_snippet(sp) {
     // Use the snippet to generate a suggested fix
     err.span_suggestion(suggestion_sp, "try using a qux here", format!("qux {}", snip));
 } else {
@@ -96,7 +96,7 @@ For example, to make our `qux` suggestion machine-applicable, we would do:
 ```rust,ignore
 let mut err = sess.struct_span_err(sp, "oh no! this is an error!");
 
-if let Ok(snippet) = sess.codemap().span_to_snippet(sp) {
+if let Ok(snippet) = sess.source_map().span_to_snippet(sp) {
     // Add applicability info!
     err.span_suggestion_with_applicability(
         suggestion_sp,
@@ -214,7 +214,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for WhileTrue {
                 if let ast::LitKind::Bool(true) = lit.node {
                     if lit.span.ctxt() == SyntaxContext::empty() {
                         let msg = "denote infinite loops with `loop { ... }`";
-                        let condition_span = cx.tcx.sess.codemap().def_span(e.span);
+                        let condition_span = cx.tcx.sess.source_map().def_span(e.span);
                         let mut err = cx.struct_span_lint(WHILE_TRUE, condition_span, msg);
                         err.span_suggestion_short(condition_span, "use `loop`", "loop".to_owned());
                         err.emit();
diff --git a/src/doc/rustc-dev-guide/src/rustc-driver.md b/src/doc/rustc-dev-guide/src/rustc-driver.md
index 1550b14e9bb..39794983674 100644
--- a/src/doc/rustc-dev-guide/src/rustc-driver.md
+++ b/src/doc/rustc-dev-guide/src/rustc-driver.md
@@ -2,7 +2,7 @@
 
 The [`rustc_driver`] is essentially `rustc`'s `main()` function. It acts as
 the glue for running the various phases of the compiler in the correct order,
-managing state such as the [`CodeMap`] \(maps AST nodes to source code),
+managing state such as the [`SourceMap`] \(maps AST nodes to source code),
 [`Session`] \(general build context and error messaging) and the [`TyCtxt`]
 \(the "typing context", allowing you to query the type system and other cool
 stuff). The `rustc_driver` crate also provides external users with a method
@@ -71,6 +71,6 @@ thread-locals, although you should rarely need to touch it.
 [`CompileState`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/driver/struct.CompileState.html
 [`Session`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/session/struct.Session.html
 [`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/struct.TyCtxt.html
-[`CodeMap`]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/codemap/struct.CodeMap.html
+[`SourceMap`]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/source_map/struct.SourceMap.html
 [stupid-stats]: https://github.com/nrc/stupid-stats
 [Appendix A]: appendix/stupid-stats.html
diff --git a/src/doc/rustc-dev-guide/src/the-parser.md b/src/doc/rustc-dev-guide/src/the-parser.md
index e89c09e9e23..62b43c0eee9 100644
--- a/src/doc/rustc-dev-guide/src/the-parser.md
+++ b/src/doc/rustc-dev-guide/src/the-parser.md
@@ -14,7 +14,7 @@ Like most parsers, the parsing process is composed of two main steps,
 
 The `syntax` crate contains several main players,
 
-- a [`CodeMap`] for mapping AST nodes to their source code
+- a [`SourceMap`] for mapping AST nodes to their source code
 - the [ast module] contains types corresponding to each AST node
 - a [`StringReader`] for lexing source code into tokens
 - the [parser module] and [`Parser`] struct are in charge of actually parsing
@@ -23,21 +23,21 @@ The `syntax` crate contains several main players,
   nodes.
 
 The main entrypoint to the parser is via the various `parse_*` functions in the
-[parser module]. They let you do things like turn a [`FileMap`][filemap] (e.g.
+[parser module]. They let you do things like turn a [`SourceFile`][sourcefile] (e.g.
 the source in a single file) into a token stream, create a parser from the
 token stream, and then execute the parser to get a `Crate` (the root AST node).
 
 To minimise the amount of copying that is done, both the `StringReader` and
 `Parser` have lifetimes which bind them to the parent `ParseSess`. This contains
-all the information needed while parsing, as well as the `CodeMap` itself.
+all the information needed while parsing, as well as the `SourceMap` itself.
 
 [libsyntax]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/index.html
 [rustc_errors]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/index.html
 [ast]: https://en.wikipedia.org/wiki/Abstract_syntax_tree
-[`CodeMap`]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/codemap/struct.CodeMap.html
+[`SourceMap`]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/source_map/struct.SourceMap.html
 [ast module]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/ast/index.html
 [parser module]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/parse/index.html
 [`Parser`]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/parse/parser/struct.Parser.html
 [`StringReader`]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/parse/lexer/struct.StringReader.html
 [visit module]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/visit/index.html
-[filemap]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/codemap/struct.FileMap.html
+[sourcefile]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/source_map/struct.SourceFile.html