Rename syntax_pos to rustc_span in source code
This commit is contained in:
parent
38aa6bdfd7
commit
70f1d57048
383 changed files with 601 additions and 601 deletions
|
|
@ -17,7 +17,7 @@ syntax = { path = "../libsyntax" }
|
|||
rustc_builtin_macros = { path = "../librustc_builtin_macros" }
|
||||
rustc_expand = { path = "../librustc_expand" }
|
||||
rustc_parse = { path = "../librustc_parse" }
|
||||
syntax_pos = { path = "../librustc_span", package = "rustc_span" }
|
||||
rustc_span = { path = "../librustc_span" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
rustc = { path = "../librustc" }
|
||||
rustc_ast_lowering = { path = "../librustc_ast_lowering" }
|
||||
|
|
|
|||
|
|
@ -11,17 +11,17 @@
|
|||
|
||||
use rustc::ty::tls;
|
||||
use rustc_errors::{Diagnostic, TRACK_DIAGNOSTICS};
|
||||
use rustc_span;
|
||||
use std::fmt;
|
||||
use syntax_pos;
|
||||
|
||||
/// This is a callback from libsyntax as it cannot access the implicit state
|
||||
/// in librustc otherwise.
|
||||
fn span_debug(span: syntax_pos::Span, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fn span_debug(span: rustc_span::Span, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
tls::with_opt(|tcx| {
|
||||
if let Some(tcx) = tcx {
|
||||
write!(f, "{}", tcx.sess.source_map().span_to_string(span))
|
||||
} else {
|
||||
syntax_pos::default_span_debug(span, f)
|
||||
rustc_span::default_span_debug(span, f)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -43,6 +43,6 @@ fn track_diagnostic(diagnostic: &Diagnostic) {
|
|||
/// Sets up the callbacks in prior crates which we want to refer to the
|
||||
/// TyCtxt in.
|
||||
pub fn setup_callbacks() {
|
||||
syntax_pos::SPAN_DEBUG.swap(&(span_debug as fn(_, &mut fmt::Formatter<'_>) -> _));
|
||||
rustc_span::SPAN_DEBUG.swap(&(span_debug as fn(_, &mut fmt::Formatter<'_>) -> _));
|
||||
TRACK_DIAGNOSTICS.swap(&(track_diagnostic as fn(&_)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use rustc_data_structures::sync::Lrc;
|
|||
use rustc_data_structures::OnDrop;
|
||||
use rustc_errors::registry::Registry;
|
||||
use rustc_parse::new_parser_from_source_str;
|
||||
use rustc_span::edition;
|
||||
use std::path::PathBuf;
|
||||
use std::result;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
|
@ -20,7 +21,6 @@ use syntax::ast::{self, MetaItemKind};
|
|||
use syntax::sess::ParseSess;
|
||||
use syntax::source_map::{FileLoader, FileName, SourceMap};
|
||||
use syntax::token;
|
||||
use syntax_pos::edition;
|
||||
|
||||
pub type Result<T> = result::Result<T, ErrorReported>;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ use rustc_passes::{self, ast_validation, hir_stats, layout_test};
|
|||
use rustc_plugin_impl as plugin;
|
||||
use rustc_privacy;
|
||||
use rustc_resolve::{Resolver, ResolverArenas};
|
||||
use rustc_span::FileName;
|
||||
use rustc_traits;
|
||||
use rustc_typeck as typeck;
|
||||
use syntax::early_buffered_lints::BufferedEarlyLint;
|
||||
|
|
@ -40,7 +41,6 @@ use syntax::mut_visit::MutVisitor;
|
|||
use syntax::symbol::Symbol;
|
||||
use syntax::util::node_count::NodeCounter;
|
||||
use syntax::{self, ast, visit};
|
||||
use syntax_pos::FileName;
|
||||
|
||||
use rustc_serialize::json;
|
||||
use tempfile::Builder as TempFileBuilder;
|
||||
|
|
@ -470,7 +470,7 @@ pub fn lower_to_hir<'res, 'tcx>(
|
|||
|
||||
// Discard hygiene data, which isn't required after lowering to HIR.
|
||||
if !sess.opts.debugging_opts.keep_hygiene_data {
|
||||
syntax_pos::hygiene::clear_syntax_context_map();
|
||||
rustc_span::hygiene::clear_syntax_context_map();
|
||||
}
|
||||
|
||||
Ok(hir_forest)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use rustc_data_structures::sync::{Lock, Lrc};
|
|||
use rustc_errors::registry::Registry;
|
||||
use rustc_metadata::dynamic_lib::DynamicLibrary;
|
||||
use rustc_resolve::{self, Resolver};
|
||||
use rustc_span::edition::Edition;
|
||||
use smallvec::SmallVec;
|
||||
use std::env;
|
||||
use std::io::{self, Write};
|
||||
|
|
@ -30,7 +31,6 @@ use syntax::source_map::{FileLoader, RealFileLoader, SourceMap};
|
|||
use syntax::symbol::{sym, Symbol};
|
||||
use syntax::util::lev_distance::find_best_match_for_name;
|
||||
use syntax::{self, ast, attr};
|
||||
use syntax_pos::edition::Edition;
|
||||
|
||||
/// Adds `target_feature = "..."` cfgs for a variety of platform
|
||||
/// specific features (SSE, NEON etc.).
|
||||
|
|
@ -186,14 +186,14 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
|
|||
|
||||
syntax::with_globals(edition, || {
|
||||
syntax::GLOBALS.with(|syntax_globals| {
|
||||
syntax_pos::GLOBALS.with(|syntax_pos_globals| {
|
||||
rustc_span::GLOBALS.with(|rustc_span_globals| {
|
||||
// The main handler runs for each Rayon worker thread and sets up
|
||||
// the thread local rustc uses. syntax_globals and syntax_pos_globals are
|
||||
// the thread local rustc uses. syntax_globals and rustc_span_globals are
|
||||
// captured and set on the new threads. ty::tls::with_thread_locals sets up
|
||||
// thread local callbacks from libsyntax
|
||||
let main_handler = move |thread: ThreadBuilder| {
|
||||
syntax::GLOBALS.set(syntax_globals, || {
|
||||
syntax_pos::GLOBALS.set(syntax_pos_globals, || {
|
||||
rustc_span::GLOBALS.set(rustc_span_globals, || {
|
||||
if let Some(stderr) = stderr {
|
||||
io::set_panic(Some(box Sink(stderr.clone())));
|
||||
}
|
||||
|
|
@ -718,7 +718,7 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a, '_> {
|
|||
stmts: s.into_iter().collect(),
|
||||
rules,
|
||||
id: resolver.next_node_id(),
|
||||
span: syntax_pos::DUMMY_SP,
|
||||
span: rustc_span::DUMMY_SP,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -726,14 +726,14 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a, '_> {
|
|||
let expr = P(ast::Expr {
|
||||
id: resolver.next_node_id(),
|
||||
kind: ast::ExprKind::Block(P(b), None),
|
||||
span: syntax_pos::DUMMY_SP,
|
||||
span: rustc_span::DUMMY_SP,
|
||||
attrs: AttrVec::new(),
|
||||
});
|
||||
|
||||
ast::Stmt {
|
||||
id: resolver.next_node_id(),
|
||||
kind: ast::StmtKind::Expr(expr),
|
||||
span: syntax_pos::DUMMY_SP,
|
||||
span: rustc_span::DUMMY_SP,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -741,13 +741,13 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a, '_> {
|
|||
let loop_expr = P(ast::Expr {
|
||||
kind: ast::ExprKind::Loop(P(empty_block), None),
|
||||
id: self.resolver.next_node_id(),
|
||||
span: syntax_pos::DUMMY_SP,
|
||||
span: rustc_span::DUMMY_SP,
|
||||
attrs: AttrVec::new(),
|
||||
});
|
||||
|
||||
let loop_stmt = ast::Stmt {
|
||||
id: self.resolver.next_node_id(),
|
||||
span: syntax_pos::DUMMY_SP,
|
||||
span: rustc_span::DUMMY_SP,
|
||||
kind: ast::StmtKind::Expr(loop_expr),
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue