pacify the parallel compiler

This commit is contained in:
Mazdak Farrokhzad 2020-01-09 09:40:55 +01:00
parent b59235975e
commit 8be2a04c7e
2 changed files with 6 additions and 3 deletions

View File

@ -41,6 +41,7 @@ use crate::ty::{ExistentialPredicate, InferTy, ParamTy, PolyFnSig, Predicate, Pr
use crate::ty::{InferConst, ParamConst};
use crate::ty::{List, TyKind, TyS};
use crate::util::common::ErrorReported;
use rustc_data_structures::sync;
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex, LOCAL_CRATE};
@ -951,7 +952,7 @@ pub struct GlobalCtxt<'tcx> {
///
/// FIXME(Centril): consider `dyn LintStoreMarker` once
/// we can upcast to `Any` for some additional type safety.
pub lint_store: Lrc<dyn Any>,
pub lint_store: Lrc<dyn Any + sync::Sync + sync::Send>,
pub dep_graph: DepGraph,
@ -1120,7 +1121,7 @@ impl<'tcx> TyCtxt<'tcx> {
/// reference to the context, to allow formatting values that need it.
pub fn create_global_ctxt(
s: &'tcx Session,
lint_store: Lrc<dyn Any>,
lint_store: Lrc<dyn Any + sync::Send + sync::Sync>,
local_providers: ty::query::Providers<'tcx>,
extern_providers: ty::query::Providers<'tcx>,
arenas: &'tcx AllArenas,

View File

@ -28,12 +28,14 @@ use syntax::ast;
use syntax::walk_list;
use log::debug;
use std::any::Any;
use std::slice;
/// Extract the `LintStore` from the query context.
/// This function exists because we've erased `LintStore` as `dyn Any` in the context.
crate fn unerased_lint_store<'tcx>(tcx: TyCtxt<'tcx>) -> &'tcx LintStore {
tcx.lint_store.downcast_ref().unwrap()
let store: &dyn Any = &*tcx.lint_store;
store.downcast_ref().unwrap()
}
macro_rules! lint_callback { ($cx:expr, $f:ident, $($args:expr),*) => ({