use crate::hair::*;
use crate::hair::util::UserAnnotatedTyHelpers;
-use rustc_data_structures::indexed_vec::Idx;
+use rustc_index::vec::Idx;
use rustc::hir::def_id::DefId;
use rustc::hir::Node;
use rustc::middle::region;
use rustc::infer::InferCtxt;
use rustc::ty::subst::Subst;
use rustc::ty::{self, Ty, TyCtxt};
-use rustc::ty::subst::{Kind, InternalSubsts};
+use rustc::ty::subst::{GenericArg, InternalSubsts};
use rustc::ty::layout::VariantIdx;
use syntax::ast;
use syntax::attr;
impl<'a, 'tcx> Cx<'a, 'tcx> {
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>, src_id: hir::HirId) -> Cx<'a, 'tcx> {
let tcx = infcx.tcx;
- let src_def_id = tcx.hir().local_def_id_from_hir_id(src_id);
+ let src_def_id = tcx.hir().local_def_id(src_id);
let tables = tcx.typeck_tables_of(src_def_id);
let body_owner_kind = tcx.hir().body_owner_kind(src_id);
infcx,
root_lint_level: src_id,
param_env: tcx.param_env(src_def_id),
- identity_substs: InternalSubsts::identity_for_item(tcx.global_tcx(), src_def_id),
+ identity_substs: InternalSubsts::identity_for_item(tcx, src_def_id),
region_scope_tree: tcx.region_scope_tree(src_def_id),
tables,
constness,
}
}
- pub fn pattern_from_hir(&mut self, p: &hir::Pat) -> Pattern<'tcx> {
- let tcx = self.tcx.global_tcx();
- let p = match tcx.hir().get(p.hir_id) {
+ pub fn pattern_from_hir(&mut self, p: &hir::Pat) -> Pat<'tcx> {
+ let p = match self.tcx.hir().get(p.hir_id) {
Node::Pat(p) | Node::Binding(p) => p,
node => bug!("pattern became {:?}", node)
};
- Pattern::from_hir(tcx,
- self.param_env.and(self.identity_substs),
- self.tables(),
- p)
+ Pat::from_hir(self.tcx, self.param_env.and(self.identity_substs), self.tables(), p)
}
pub fn trait_method(&mut self,
trait_def_id: DefId,
method_name: Symbol,
self_ty: Ty<'tcx>,
- params: &[Kind<'tcx>])
- -> (Ty<'tcx>, &'tcx ty::Const<'tcx>) {
+ params: &[GenericArg<'tcx>])
+ -> &'tcx ty::Const<'tcx> {
let substs = self.tcx.mk_substs_trait(self_ty, params);
for item in self.tcx.associated_items(trait_def_id) {
if item.kind == ty::AssocKind::Method && item.ident.name == method_name {
let method_ty = self.tcx.type_of(item.def_id);
let method_ty = method_ty.subst(self.tcx, substs);
- return (method_ty, ty::Const::zero_sized(self.tcx, method_ty));
+ return ty::Const::zero_sized(self.tcx, method_ty);
}
}
}
pub fn needs_drop(&mut self, ty: Ty<'tcx>) -> bool {
- ty.needs_drop(self.tcx.global_tcx(), self.param_env)
+ ty.needs_drop(self.tcx, self.param_env)
}
pub fn tcx(&self) -> TyCtxt<'tcx> {