diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-02-29 20:37:32 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-02-29 21:59:09 +0300 |
| commit | e08c279eacfd37b8921378c8bd4ef8b8dc9bd176 (patch) | |
| tree | a0aba27f258d4c1cc2e9692e4e653f558c819784 /src/librustc_interface | |
| parent | 6054a30370209472f2af45d2a84a9a9796b3c64a (diff) | |
Rename `syntax` to `rustc_ast` in source code
Diffstat (limited to 'src/librustc_interface')
| -rw-r--r-- | src/librustc_interface/Cargo.toml | 2 | ||||
| -rw-r--r-- | src/librustc_interface/interface.rs | 6 | ||||
| -rw-r--r-- | src/librustc_interface/passes.rs | 4 | ||||
| -rw-r--r-- | src/librustc_interface/proc_macro_decls.rs | 2 | ||||
| -rw-r--r-- | src/librustc_interface/queries.rs | 2 | ||||
| -rw-r--r-- | src/librustc_interface/tests.rs | 11 | ||||
| -rw-r--r-- | src/librustc_interface/util.rs | 18 |
7 files changed, 22 insertions, 23 deletions
diff --git a/src/librustc_interface/Cargo.toml b/src/librustc_interface/Cargo.toml index cc5d9da52cb..b29480a8810 100644 --- a/src/librustc_interface/Cargo.toml +++ b/src/librustc_interface/Cargo.toml @@ -13,7 +13,7 @@ doctest = false log = "0.4" rayon = { version = "0.3.0", package = "rustc-rayon" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } -syntax = { path = "../librustc_ast", package = "rustc_ast" } +rustc_ast = { path = "../librustc_ast" } rustc_attr = { path = "../librustc_attr" } rustc_builtin_macros = { path = "../librustc_builtin_macros" } rustc_expand = { path = "../librustc_expand" } diff --git a/src/librustc_interface/interface.rs b/src/librustc_interface/interface.rs index e213a4d33a6..e15217dfa67 100644 --- a/src/librustc_interface/interface.rs +++ b/src/librustc_interface/interface.rs @@ -7,6 +7,8 @@ use rustc::session::early_error; use rustc::session::{DiagnosticOutput, Session}; use rustc::ty; use rustc::util::common::ErrorReported; +use rustc_ast::ast::{self, MetaItemKind}; +use rustc_ast::token; use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::Lrc; @@ -20,8 +22,6 @@ use rustc_span::source_map::{FileLoader, FileName, SourceMap}; use std::path::PathBuf; use std::result; use std::sync::{Arc, Mutex}; -use syntax::ast::{self, MetaItemKind}; -use syntax::token; pub type Result<T> = result::Result<T, ErrorReported>; @@ -78,7 +78,7 @@ impl Compiler { /// Converts strings provided as `--cfg [cfgspec]` into a `crate_cfg`. pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String>)> { - syntax::with_default_globals(move || { + rustc_ast::with_default_globals(move || { let cfg = cfgspecs .into_iter() .map(|s| { diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 96a2ac08f2c..1e9b76c3e14 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -16,6 +16,8 @@ use rustc::session::Session; use rustc::ty::steal::Steal; use rustc::ty::{self, GlobalCtxt, ResolverOutputs, TyCtxt}; use rustc::util::common::ErrorReported; +use rustc_ast::mut_visit::MutVisitor; +use rustc_ast::{self, ast, visit}; use rustc_codegen_ssa::back::link::emit_metadata; use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_codegen_utils::link::filename_for_metadata; @@ -36,8 +38,6 @@ use rustc_resolve::{Resolver, ResolverArenas}; use rustc_span::symbol::Symbol; use rustc_span::FileName; use rustc_typeck as typeck; -use syntax::mut_visit::MutVisitor; -use syntax::{self, ast, visit}; use rustc_serialize::json; use tempfile::Builder as TempFileBuilder; diff --git a/src/librustc_interface/proc_macro_decls.rs b/src/librustc_interface/proc_macro_decls.rs index 9238f88b2b5..076a8cef92c 100644 --- a/src/librustc_interface/proc_macro_decls.rs +++ b/src/librustc_interface/proc_macro_decls.rs @@ -1,10 +1,10 @@ use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_ast::attr; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::symbol::sym; -use syntax::attr; pub fn find(tcx: TyCtxt<'_>) -> Option<DefId> { tcx.proc_macro_decls_static(LOCAL_CRATE) diff --git a/src/librustc_interface/queries.rs b/src/librustc_interface/queries.rs index 0c77ab57500..426d97cc09b 100644 --- a/src/librustc_interface/queries.rs +++ b/src/librustc_interface/queries.rs @@ -8,6 +8,7 @@ use rustc::session::Session; use rustc::ty::steal::Steal; use rustc::ty::{GlobalCtxt, ResolverOutputs}; use rustc::util::common::ErrorReported; +use rustc_ast::{self, ast}; use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_data_structures::sync::{Lrc, Once, WorkerLocal}; use rustc_hir::def_id::LOCAL_CRATE; @@ -18,7 +19,6 @@ use std::any::Any; use std::cell::{Ref, RefCell, RefMut}; use std::mem; use std::rc::Rc; -use syntax::{self, ast}; /// Represent the result of a query. /// This result can be stolen with the `take` method and generated with the `compute` method. diff --git a/src/librustc_interface/tests.rs b/src/librustc_interface/tests.rs index ec75a1c6a39..1b80cf4e3db 100644 --- a/src/librustc_interface/tests.rs +++ b/src/librustc_interface/tests.rs @@ -18,7 +18,6 @@ use rustc_target::spec::{MergeFunctions, PanicStrategy, RelroLevel}; use std::collections::{BTreeMap, BTreeSet}; use std::iter::FromIterator; use std::path::PathBuf; -use syntax; type CfgSpecs = FxHashSet<(String, Option<String>)>; @@ -64,7 +63,7 @@ fn mk_map<K: Ord, V>(entries: Vec<(K, V)>) -> BTreeMap<K, V> { // When the user supplies --test we should implicitly supply --cfg test #[test] fn test_switch_implies_cfg_test() { - syntax::with_default_globals(|| { + rustc_ast::with_default_globals(|| { let matches = optgroups().parse(&["--test".to_string()]).unwrap(); let (sess, cfg) = mk_session(matches); let cfg = build_configuration(&sess, to_crate_config(cfg)); @@ -75,7 +74,7 @@ fn test_switch_implies_cfg_test() { // When the user supplies --test and --cfg test, don't implicitly add another --cfg test #[test] fn test_switch_implies_cfg_test_unless_cfg_test() { - syntax::with_default_globals(|| { + rustc_ast::with_default_globals(|| { let matches = optgroups().parse(&["--test".to_string(), "--cfg=test".to_string()]).unwrap(); let (sess, cfg) = mk_session(matches); let cfg = build_configuration(&sess, to_crate_config(cfg)); @@ -87,20 +86,20 @@ fn test_switch_implies_cfg_test_unless_cfg_test() { #[test] fn test_can_print_warnings() { - syntax::with_default_globals(|| { + rustc_ast::with_default_globals(|| { let matches = optgroups().parse(&["-Awarnings".to_string()]).unwrap(); let (sess, _) = mk_session(matches); assert!(!sess.diagnostic().can_emit_warnings()); }); - syntax::with_default_globals(|| { + rustc_ast::with_default_globals(|| { let matches = optgroups().parse(&["-Awarnings".to_string(), "-Dwarnings".to_string()]).unwrap(); let (sess, _) = mk_session(matches); assert!(sess.diagnostic().can_emit_warnings()); }); - syntax::with_default_globals(|| { + rustc_ast::with_default_globals(|| { let matches = optgroups().parse(&["-Adead_code".to_string()]).unwrap(); let (sess, _) = mk_session(matches); assert!(sess.diagnostic().can_emit_warnings()); diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs index c52a3aefaba..10a8c0a63f1 100644 --- a/src/librustc_interface/util.rs +++ b/src/librustc_interface/util.rs @@ -1,6 +1,11 @@ use log::info; use rustc::lint; use rustc::ty; +use rustc_ast::ast::{AttrVec, BlockCheckMode}; +use rustc_ast::mut_visit::{visit_clobber, MutVisitor, *}; +use rustc_ast::ptr::P; +use rustc_ast::util::lev_distance::find_best_match_for_name; +use rustc_ast::{self, ast}; use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; @@ -29,11 +34,6 @@ use std::path::{Path, PathBuf}; use std::sync::{Arc, Mutex, Once}; #[cfg(not(parallel_compiler))] use std::{panic, thread}; -use syntax::ast::{AttrVec, BlockCheckMode}; -use syntax::mut_visit::{visit_clobber, MutVisitor, *}; -use syntax::ptr::P; -use syntax::util::lev_distance::find_best_match_for_name; -use syntax::{self, ast}; /// Adds `target_feature = "..."` cfgs for a variety of platform /// specific features (SSE, NEON etc.). @@ -147,7 +147,7 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>( crate::callbacks::setup_callbacks(); scoped_thread(cfg, || { - syntax::with_globals(edition, || { + rustc_ast::with_globals(edition, || { ty::tls::GCX_PTR.set(&Lock::new(0), || { if let Some(stderr) = stderr { io::set_panic(Some(box Sink(stderr.clone()))); @@ -183,15 +183,15 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>( let with_pool = move |pool: &ThreadPool| pool.install(move || f()); - syntax::with_globals(edition, || { - syntax::GLOBALS.with(|syntax_globals| { + rustc_ast::with_globals(edition, || { + rustc_ast::GLOBALS.with(|syntax_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 rustc_span_globals are // captured and set on the new threads. ty::tls::with_thread_locals sets up // thread local callbacks from librustc_ast let main_handler = move |thread: ThreadBuilder| { - syntax::GLOBALS.set(syntax_globals, || { + rustc_ast::GLOBALS.set(syntax_globals, || { rustc_span::GLOBALS.set(rustc_span_globals, || { if let Some(stderr) = stderr { io::set_panic(Some(box Sink(stderr.clone()))); |
