]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/hair/cx/mod.rs
Rollup merge of #64895 - davidtwco:issue-64130-async-error-definition, r=nikomatsakis
[rust.git] / src / librustc_mir / hair / cx / mod.rs
index 4e197f1ed4ecf8aa82c37c9215014ea67b1bf076..e120b496d3d09c57eea70c65f447d07537fd0f3f 100644 (file)
@@ -5,14 +5,14 @@
 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;
@@ -54,7 +54,7 @@ pub struct Cx<'a, 'tcx> {
 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);
 
@@ -83,7 +83,7 @@ pub fn new(infcx: &'a InferCtxt<'a, 'tcx>, src_id: hir::HirId) -> Cx<'a, 'tcx> {
             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,
@@ -153,30 +153,26 @@ pub fn const_eval_literal(
         }
     }
 
-    pub fn pattern_from_hir(&mut self, p: &hir::Pat) -> Pattern<'tcx> {
-        let tcx = self.tcx.global_tcx();
-        let p = match tcx.hir().get_by_hir_id(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);
             }
         }
 
@@ -190,7 +186,7 @@ pub fn all_fields(&mut self, adt_def: &ty::AdtDef, variant_index: VariantIdx) ->
     }
 
     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> {