Skip to content
Permalink
Browse files

pacify the parallel compiler

  • Loading branch information
Centril committed Jan 9, 2020
1 parent b592359 commit 8be2a04c7e6bf78a614840dc7152990a451ac4e0
Showing with 6 additions and 3 deletions.
  1. +3 −2 src/librustc/ty/context.rs
  2. +3 −1 src/librustc_lint/late.rs
@@ -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,
@@ -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),*) => ({

0 comments on commit 8be2a04

Please sign in to comment.
You can’t perform that action at this time.