mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
mv codemap source_map
This commit is contained in:
@@ -43,9 +43,9 @@ fn default() -> Self {
|
||||
|
||||
pub struct StringReader<'a> {
|
||||
pub sess: &'a ParseSess,
|
||||
/// The absolute offset within the codemap of the next character to read
|
||||
/// The absolute offset within the source_map of the next character to read
|
||||
pub next_pos: BytePos,
|
||||
/// The absolute offset within the codemap of the current character
|
||||
/// The absolute offset within the source_map of the current character
|
||||
pub pos: BytePos,
|
||||
/// The current character (which has been read from self.pos)
|
||||
pub ch: Option<char>,
|
||||
|
||||
@@ -189,7 +189,7 @@ pub fn new_parser_from_file<'a>(sess: &'a ParseSess, path: &Path) -> Parser<'a>
|
||||
}
|
||||
|
||||
/// Given a session, a crate config, a path, and a span, add
|
||||
/// the file at the given path to the codemap, and return a parser.
|
||||
/// the file at the given path to the source_map, and return a parser.
|
||||
/// On an error, use the given span as the source of the problem.
|
||||
crate fn new_sub_parser_from_file<'a>(sess: &'a ParseSess,
|
||||
path: &Path,
|
||||
@@ -224,7 +224,7 @@ pub fn new_parser_from_tts(sess: &ParseSess, tts: Vec<TokenTree>) -> Parser {
|
||||
// base abstractions
|
||||
|
||||
/// Given a session and a path and an optional span (for error reporting),
|
||||
/// add the path to the session's codemap and return the new source_file.
|
||||
/// add the path to the session's source_map and return the new source_file.
|
||||
fn file_to_source_file(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
|
||||
-> Lrc<SourceFile> {
|
||||
match sess.source_map().load_file(path) {
|
||||
|
||||
@@ -6322,7 +6322,7 @@ pub fn default_submod_path(
|
||||
id: ast::Ident,
|
||||
relative: Option<ast::Ident>,
|
||||
dir_path: &Path,
|
||||
codemap: &SourceMap) -> ModulePath
|
||||
source_map: &SourceMap) -> ModulePath
|
||||
{
|
||||
// If we're in a foo.rs file instead of a mod.rs file,
|
||||
// we need to look for submodules in
|
||||
@@ -6342,8 +6342,8 @@ pub fn default_submod_path(
|
||||
relative_prefix, mod_name, path::MAIN_SEPARATOR);
|
||||
let default_path = dir_path.join(&default_path_str);
|
||||
let secondary_path = dir_path.join(&secondary_path_str);
|
||||
let default_exists = codemap.file_exists(&default_path);
|
||||
let secondary_exists = codemap.file_exists(&secondary_path);
|
||||
let default_exists = source_map.file_exists(&default_path);
|
||||
let secondary_exists = source_map.file_exists(&secondary_path);
|
||||
|
||||
let result = match (default_exists, secondary_exists) {
|
||||
(true, false) => Ok(ModulePathSuccess {
|
||||
|
||||
@@ -206,7 +206,7 @@ fn next_start_pos(&self) -> usize {
|
||||
match self.files.borrow().file_maps.last() {
|
||||
None => 0,
|
||||
// Add one so there is some space between files. This lets us distinguish
|
||||
// positions in the codemap, even in the presence of zero-length files.
|
||||
// positions in the source_map, even in the presence of zero-length files.
|
||||
Some(last) => last.end_pos.to_usize() + 1,
|
||||
}
|
||||
}
|
||||
@@ -895,7 +895,7 @@ pub fn generate_fn_name_span(&self, span: Span) -> Option<Span> {
|
||||
///
|
||||
/// 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.
|
||||
/// source_map functions and this function to something more robust.
|
||||
pub fn generate_local_type_param_snippet(&self, span: Span) -> Option<(Span, String)> {
|
||||
// Try to extend the span to the previous "fn" keyword to retrieve the function
|
||||
// signature
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
use tokenstream::TokenStream;
|
||||
|
||||
/// Craft a span that will be ignored by the stability lint's
|
||||
/// call to codemap's `is_internal` check.
|
||||
/// call to source_map's `is_internal` check.
|
||||
/// The expanded code uses the unstable `#[prelude_import]` attribute.
|
||||
fn ignored_span(sp: Span) -> Span {
|
||||
let mark = Mark::fresh(Mark::root());
|
||||
|
||||
@@ -324,7 +324,7 @@ fn generate_test_harness(sess: &ParseSess,
|
||||
}
|
||||
|
||||
/// Craft a span that will be ignored by the stability lint's
|
||||
/// call to codemap's `is_internal` check.
|
||||
/// call to source_map's `is_internal` check.
|
||||
/// The expanded code calls some unstable functions in the test crate.
|
||||
fn ignored_span(cx: &TestCtxt, sp: Span) -> Span {
|
||||
sp.with_ctxt(cx.ctxt)
|
||||
|
||||
Reference in New Issue
Block a user