use crate::arena::Arena;
use crate::dep_graph::DepGraph;
use crate::hir::place::Place as HirPlace;
-use crate::ich::{NodeIdHashingMode, StableHashingContext};
use crate::infer::canonical::{Canonical, CanonicalVarInfo, CanonicalVarInfos};
use crate::lint::{struct_lint_level, LintDiagnosticBuilder, LintLevelSource};
use crate::middle;
use rustc_index::vec::{Idx, IndexVec};
use rustc_macros::HashStable;
use rustc_middle::mir::FakeReadCause;
+use rustc_query_system::ich::{NodeIdHashingMode, StableHashingContext};
use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
use rustc_session::config::{BorrowckMode, CrateType, OutputFilenames};
use rustc_session::lint::{Level, Lint};
/// Obtain the given diagnostic item's `DefId`. Use `is_diagnostic_item` if you just want to
/// compare against another `DefId`, since `is_diagnostic_item` is cheaper.
pub fn get_diagnostic_item(self, name: Symbol) -> Option<DefId> {
- self.all_diagnostic_items(()).get(&name).copied()
+ self.all_diagnostic_items(()).name_to_id.get(&name).copied()
+ }
+
+ /// Obtain the diagnostic item's name
+ pub fn get_diagnostic_name(self, id: DefId) -> Option<Symbol> {
+ self.diagnostic_items(id.krate).id_to_name.get(&id).copied()
}
/// Check whether the diagnostic item with the given `name` has the given `DefId`.
pub fn is_diagnostic_item(self, name: Symbol, did: DefId) -> bool {
- self.diagnostic_items(did.krate).get(&name) == Some(&did)
+ self.diagnostic_items(did.krate).name_to_id.get(&name) == Some(&did)
}
pub fn stability(self) -> &'tcx stability::Index<'tcx> {
#[inline(always)]
pub fn create_stable_hashing_context(self) -> StableHashingContext<'tcx> {
- let krate = self.gcx.untracked_crate;
let resolutions = &self.gcx.untracked_resolutions;
-
- StableHashingContext::new(self.sess, krate, &resolutions.definitions, &*resolutions.cstore)
+ StableHashingContext::new(self.sess, &resolutions.definitions, &*resolutions.cstore)
}
#[inline(always)]
pub fn create_no_span_stable_hashing_context(self) -> StableHashingContext<'tcx> {
- let krate = self.gcx.untracked_crate;
let resolutions = &self.gcx.untracked_resolutions;
-
StableHashingContext::ignore_spans(
self.sess,
- krate,
&resolutions.definitions,
&*resolutions.cstore,
)
})
}
- /// Computes the def-ids of the transitive super-traits of `trait_def_id`. This (intentionally)
+ /// Computes the def-ids of the transitive supertraits of `trait_def_id`. This (intentionally)
/// does not compute the full elaborated super-predicates but just the set of def-ids. It is used
/// to identify which traits may define a given associated type to help avoid cycle errors.
/// Returns a `DefId` iterator.
}
pub fn provide(providers: &mut ty::query::Providers) {
- providers.in_scope_traits_map = |tcx, id| tcx.hir_crate(()).trait_map.get(&id);
+ providers.in_scope_traits_map =
+ |tcx, id| tcx.hir_crate(()).owners[id].as_ref().map(|owner_info| &owner_info.trait_map);
providers.resolutions = |tcx, ()| &tcx.untracked_resolutions;
providers.module_exports = |tcx, id| tcx.resolutions(()).export_map.get(&id).map(|v| &v[..]);
providers.crate_name = |tcx, id| {