]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
Rename `Ty.node` to `Ty.kind`
[rust.git] / src / librustc_mir / borrow_check / nll / region_infer / error_reporting / region_name.rs
index 6fa94269107f583388ea5f71819150d454983f5f..c4b508e030f39ac76611088214ac28db0b0b3058 100644 (file)
@@ -12,7 +12,7 @@
 use rustc::hir::def_id::DefId;
 use rustc::infer::InferCtxt;
 use rustc::mir::Body;
-use rustc::ty::subst::{SubstsRef, UnpackedKind};
+use rustc::ty::subst::{SubstsRef, GenericArgKind};
 use rustc::ty::{self, RegionKind, RegionVid, Ty, TyCtxt};
 use rustc::ty::print::RegionHighlightMode;
 use rustc_errors::DiagnosticBuilder;
@@ -292,7 +292,7 @@ fn give_name_from_error_region(
 
                     if let DefiningTy::Closure(def_id, substs) = def_ty {
                         let args_span = if let hir::ExprKind::Closure(_, _, _, span, _) =
-                            tcx.hir().expect_expr(mir_hir_id).node
+                            tcx.hir().expect_expr(mir_hir_id).kind
                         {
                             span
                         } else {
@@ -425,7 +425,7 @@ fn give_name_if_we_can_match_hir_ty_from_argument(
         let mir_hir_id = infcx.tcx.hir().as_local_hir_id(mir_def_id)?;
         let fn_decl = infcx.tcx.hir().fn_decl_by_hir_id(mir_hir_id)?;
         let argument_hir_ty: &hir::Ty = &fn_decl.inputs[argument_index];
-        match argument_hir_ty.node {
+        match argument_hir_ty.kind {
             // This indicates a variable with no type annotation, like
             // `|x|`... in that case, we can't highlight the type but
             // must highlight the variable.
@@ -527,7 +527,7 @@ fn give_name_if_we_can_match_hir_ty(
             &mut vec![(argument_ty, argument_hir_ty)];
 
         while let Some((ty, hir_ty)) = search_stack.pop() {
-            match (&ty.sty, &hir_ty.node) {
+            match (&ty.kind, &hir_ty.kind) {
                 // Check if the `argument_ty` is `&'X ..` where `'X`
                 // is the region we are looking for -- if so, and we have a `&T`
                 // on the RHS, then we want to highlight the `&` like so:
@@ -667,24 +667,24 @@ fn try_match_adt_and_generic_args<'hir>(
     ) -> Option<&'hir hir::Lifetime> {
         for (kind, hir_arg) in substs.iter().zip(&args.args) {
             match (kind.unpack(), hir_arg) {
-                (UnpackedKind::Lifetime(r), hir::GenericArg::Lifetime(lt)) => {
+                (GenericArgKind::Lifetime(r), hir::GenericArg::Lifetime(lt)) => {
                     if r.to_region_vid() == needle_fr {
                         return Some(lt);
                     }
                 }
 
-                (UnpackedKind::Type(ty), hir::GenericArg::Type(hir_ty)) => {
+                (GenericArgKind::Type(ty), hir::GenericArg::Type(hir_ty)) => {
                     search_stack.push((ty, hir_ty));
                 }
 
-                (UnpackedKind::Const(_ct), hir::GenericArg::Const(_hir_ct)) => {
+                (GenericArgKind::Const(_ct), hir::GenericArg::Const(_hir_ct)) => {
                     // Lifetimes cannot be found in consts, so we don't need
                     // to search anything here.
                 }
 
-                (UnpackedKind::Lifetime(_), _)
-                | (UnpackedKind::Type(_), _)
-                | (UnpackedKind::Const(_), _) => {
+                (GenericArgKind::Lifetime(_), _)
+                | (GenericArgKind::Type(_), _)
+                | (GenericArgKind::Const(_), _) => {
                     // I *think* that HIR lowering should ensure this
                     // doesn't happen, even in erroneous
                     // programs. Else we should use delay-span-bug.
@@ -758,7 +758,7 @@ fn give_name_if_anonymous_region_appears_in_output(
 
         let (return_span, mir_description) = match tcx.hir().get(mir_hir_id) {
             hir::Node::Expr(hir::Expr {
-                node: hir::ExprKind::Closure(_, return_ty, _, span, gen_move),
+                kind: hir::ExprKind::Closure(_, return_ty, _, span, gen_move),
                 ..
             }) => (
                 match return_ty.output {
@@ -772,7 +772,7 @@ fn give_name_if_anonymous_region_appears_in_output(
                 },
             ),
             hir::Node::ImplItem(hir::ImplItem {
-                node: hir::ImplItemKind::Method(method_sig, _),
+                kind: hir::ImplItemKind::Method(method_sig, _),
                 ..
             }) => (method_sig.decl.output.span(), ""),
             _ => (body.span, ""),
@@ -821,7 +821,7 @@ fn give_name_if_anonymous_region_appears_in_yield_ty(
 
         let yield_span = match tcx.hir().get(mir_hir_id) {
             hir::Node::Expr(hir::Expr {
-                node: hir::ExprKind::Closure(_, _, _, span, _),
+                kind: hir::ExprKind::Closure(_, _, _, span, _),
                 ..
             }) => (
                 tcx.sess.source_map().end_point(*span)