From eadff0682365f21296df54a359be63e5483a99e8 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sat, 18 Jan 2020 18:57:06 +0100 Subject: [PATCH] syntax: reexport attr globals --- src/librustc_ast_pretty/pprust/tests.rs | 2 +- src/librustc_interface/interface.rs | 2 +- src/librustc_interface/util.rs | 8 ++++---- src/librustdoc/test.rs | 2 +- src/libsyntax/lib.rs | 1 + 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/librustc_ast_pretty/pprust/tests.rs b/src/librustc_ast_pretty/pprust/tests.rs index ec6f5096d91..279e6f518a7 100644 --- a/src/librustc_ast_pretty/pprust/tests.rs +++ b/src/librustc_ast_pretty/pprust/tests.rs @@ -3,7 +3,7 @@ use super::*; use rustc_span; use rustc_span::source_map::{dummy_spanned, respan}; use syntax::ast; -use syntax::attr::with_default_globals; +use syntax::with_default_globals; fn fun_to_string( decl: &ast::FnDecl, diff --git a/src/librustc_interface/interface.rs b/src/librustc_interface/interface.rs index ae758b5e327..2a667541ad3 100644 --- a/src/librustc_interface/interface.rs +++ b/src/librustc_interface/interface.rs @@ -65,7 +65,7 @@ impl Compiler { /// Converts strings provided as `--cfg [cfgspec]` into a `crate_cfg`. pub fn parse_cfgspecs(cfgspecs: Vec) -> FxHashSet<(String, Option)> { - syntax::attr::with_default_globals(move || { + syntax::with_default_globals(move || { let cfg = cfgspecs .into_iter() .map(|s| { diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs index 3f59a0ca34a..3052c9fc26f 100644 --- a/src/librustc_interface/util.rs +++ b/src/librustc_interface/util.rs @@ -147,7 +147,7 @@ pub fn spawn_thread_pool R + Send, R: Send>( crate::callbacks::setup_callbacks(); scoped_thread(cfg, || { - syntax::attr::with_globals(edition, || { + syntax::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 R + Send, R: Send>( let with_pool = move |pool: &ThreadPool| pool.install(move || f()); - syntax::attr::with_globals(edition, || { - syntax::attr::GLOBALS.with(|syntax_globals| { + syntax::with_globals(edition, || { + syntax::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 libsyntax let main_handler = move |thread: ThreadBuilder| { - syntax::attr::GLOBALS.set(syntax_globals, || { + syntax::GLOBALS.set(syntax_globals, || { rustc_span::GLOBALS.set(rustc_span_globals, || { if let Some(stderr) = stderr { io::set_panic(Some(box Sink(stderr.clone()))); diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 52776eabdf5..936f63975a5 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -18,7 +18,7 @@ use std::path::PathBuf; use std::process::{self, Command, Stdio}; use std::str; use syntax::ast; -use syntax::attr::with_globals; +use syntax::with_globals; use tempfile::Builder as TempFileBuilder; use testing; diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index c9800da700f..66c747f2c51 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -38,6 +38,7 @@ pub mod util { pub mod ast; pub mod attr; +pub use attr::{with_default_globals, with_globals, GLOBALS}; pub mod entry; pub mod expand; pub mod mut_visit;