use log::info;
use rustc::lint;
-use rustc::session::config::{ErrorOutputType, Input, OutputFilenames};
-use rustc::session::CrateDisambiguator;
-use rustc::session::{self, config, early_error, filesearch, DiagnosticOutput, Session};
use rustc::ty;
use rustc_codegen_utils::codegen_backend::CodegenBackend;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_errors::registry::Registry;
use rustc_metadata::dynamic_lib::DynamicLibrary;
use rustc_resolve::{self, Resolver};
+use rustc_session as session;
+use rustc_session::config::{ErrorOutputType, Input, OutputFilenames};
+use rustc_session::lint::{BuiltinLintDiagnostics, LintBuffer};
+use rustc_session::CrateDisambiguator;
+use rustc_session::{config, early_error, filesearch, DiagnosticOutput, Session};
+use rustc_span::edition::Edition;
+use rustc_span::source_map::{FileLoader, RealFileLoader, SourceMap};
+use rustc_span::symbol::{sym, Symbol};
use smallvec::SmallVec;
use std::env;
use std::io::{self, Write};
use syntax::ast::{AttrVec, BlockCheckMode};
use syntax::mut_visit::{visit_clobber, MutVisitor, *};
use syntax::ptr::P;
-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.).
lint_caps,
);
- sess.prof.register_queries(|profiler| {
- rustc::ty::query::QueryName::register_with_profiler(&profiler);
- });
-
let codegen_backend = get_codegen_backend(&sess);
let mut cfg = config::build_configuration(&sess, config::to_crate_config(cfg));
cfg = cfg.stack_size(size);
}
+ crate::callbacks::setup_callbacks();
+
scoped_thread(cfg, || {
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())));
}
- ty::tls::with_thread_locals(|| f())
+ f()
})
})
})
use rayon::{ThreadBuilder, ThreadPool, ThreadPoolBuilder};
let gcx_ptr = &Lock::new(0);
+ crate::callbacks::setup_callbacks();
let mut config = ThreadPoolBuilder::new()
.thread_name(|_| "rustc".to_string())
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())));
}
- ty::tls::with_thread_locals(|| {
- ty::tls::GCX_PTR.set(gcx_ptr, || thread.run())
- })
+ ty::tls::GCX_PTR.set(gcx_ptr, || thread.run())
})
})
};
CrateDisambiguator::from(hasher.finish::<Fingerprint>())
}
-pub(crate) fn check_attr_crate_type(attrs: &[ast::Attribute], lint_buffer: &mut lint::LintBuffer) {
+pub(crate) fn check_attr_crate_type(attrs: &[ast::Attribute], lint_buffer: &mut LintBuffer) {
// Unconditionally collect crate types from attributes to make them used
for a in attrs.iter() {
if a.check_name(sym::crate_type) {
ast::CRATE_NODE_ID,
span,
"invalid `crate_type` value",
- lint::builtin::BuiltinLintDiagnostics::UnknownCrateTypes(
+ BuiltinLintDiagnostics::UnknownCrateTypes(
span,
"did you mean".to_string(),
format!("\"{}\"", candidate),
stmts: s.into_iter().collect(),
rules,
id: resolver.next_node_id(),
- span: syntax_pos::DUMMY_SP,
+ span: rustc_span::DUMMY_SP,
}
}
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,
}
}
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),
};