diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index c28631b9825..99e6c62f613 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.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, + pub lint_store: Lrc, 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, + lint_store: Lrc, local_providers: ty::query::Providers<'tcx>, extern_providers: ty::query::Providers<'tcx>, arenas: &'tcx AllArenas, diff --git a/src/librustc_lint/late.rs b/src/librustc_lint/late.rs index eb5f89c9507..30a37883775 100644 --- a/src/librustc_lint/late.rs +++ b/src/librustc_lint/late.rs @@ -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),*) => ({