Update all_traits

This commit is contained in:
John Kåre Alsaker 2018-11-30 22:58:06 +01:00
parent 10ef70bb68
commit 5751fcc3b1
3 changed files with 3 additions and 3 deletions

View File

@ -81,6 +81,7 @@ macro_rules! arena_types {
[few] lint_levels: rustc::lint::LintLevelMap,
[few] stability_index: rustc::middle::stability::Index<'tcx>,
[few] features: syntax::feature_gate::Features,
[few] all_traits: Vec<rustc::hir::def_id::DefId>,
], $tcx);
)
}

View File

@ -850,7 +850,7 @@ rustc_queries! {
/// A vector of every trait accessible in the whole crate
/// (i.e., including those from subcrates). This is used only for
/// error reporting.
query all_traits(_: CrateNum) -> Lrc<Vec<DefId>> {
query all_traits(_: CrateNum) -> &'tcx [DefId] {
desc { "fetching all foreign and local traits" }
}
}

View File

@ -6,7 +6,6 @@ use crate::middle::lang_items::FnOnceTraitLangItem;
use crate::namespace::Namespace;
use crate::util::nodemap::FxHashSet;
use errors::{Applicability, DiagnosticBuilder};
use rustc_data_structures::sync::Lrc;
use rustc::hir::{self, ExprKind, Node, QPath};
use rustc::hir::def::{Res, DefKind};
use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, DefId};
@ -844,7 +843,7 @@ fn compute_all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Vec<DefId>
pub fn provide(providers: &mut ty::query::Providers<'_>) {
providers.all_traits = |tcx, cnum| {
assert_eq!(cnum, LOCAL_CRATE);
Lrc::new(compute_all_traits(tcx))
&tcx.arena.alloc(compute_all_traits(tcx))[..]
}
}