]> git.lizzy.rs Git - rust.git/commitdiff
rustc: remove fmt::{Debug,Display} from ty::TyKind.
authorEduard-Mihai Burtescu <edy.burt@gmail.com>
Fri, 7 Dec 2018 17:14:30 +0000 (19:14 +0200)
committerEduard-Mihai Burtescu <edy.burt@gmail.com>
Fri, 15 Mar 2019 07:26:13 +0000 (09:26 +0200)
22 files changed:
src/librustc/middle/mem_categorization.rs
src/librustc/traits/error_reporting.rs
src/librustc/ty/relate.rs
src/librustc/ty/sty.rs
src/librustc/util/ppaux.rs
src/librustc_codegen_llvm/intrinsic.rs
src/librustc_codegen_ssa/mir/constant.rs
src/librustc_codegen_ssa/traits/type_.rs
src/librustc_mir/borrow_check/error_reporting.rs
src/librustc_mir/hair/cx/expr.rs
src/librustc_mir/hair/pattern/mod.rs
src/librustc_mir/hair/util.rs
src/librustc_mir/interpret/cast.rs
src/librustc_mir/interpret/operator.rs
src/librustc_mir/interpret/place.rs
src/librustc_mir/monomorphize/collector.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/_match.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/upvar.rs
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/check/writeback.rs

index a3e8598194e790550f12d5a3ff5f08a412a571b7..ea1c9d8141611ce3276e752a57cf7b57b46a21df 100644 (file)
@@ -786,7 +786,8 @@ fn cat_upvar(&self,
         // FnMut          | copied -> &'env mut  | upvar -> &'env mut -> &'up bk
         // FnOnce         | copied               | upvar -> &'up bk
 
-        let kind = match self.node_ty(fn_hir_id)?.sty {
+        let ty = self.node_ty(fn_hir_id)?;
+        let kind = match ty.sty {
             ty::Generator(..) => ty::ClosureKind::FnOnce,
             ty::Closure(closure_def_id, closure_substs) => {
                 match self.infcx {
@@ -803,7 +804,7 @@ fn cat_upvar(&self,
                                 .closure_kind(closure_def_id, self.tcx.global_tcx()),
                 }
             }
-            ref t => span_bug!(span, "unexpected type for fn in mem_categorization: {:?}", t),
+            _ => span_bug!(span, "unexpected type for fn in mem_categorization: {:?}", ty),
         };
 
         let closure_expr_def_id = self.tcx.hir().local_def_id(fn_node_id);
@@ -1064,7 +1065,7 @@ pub fn cat_deref(
                 let bk = ty::BorrowKind::from_mutbl(mutbl);
                 BorrowedPtr(bk, r)
             }
-            ref ty => bug!("unexpected type in cat_deref: {:?}", ty)
+            _ => bug!("unexpected type in cat_deref: {:?}", base_cmt.ty)
         };
         let ret = cmt_ {
             hir_id: node.hir_id(),
@@ -1279,11 +1280,12 @@ fn cat_pattern_<F>(&self, mut cmt: cmt<'tcx>, pat: &hir::Pat, op: &mut F) -> McR
                         self.tcx.adt_def(enum_def).variant_with_id(def_id).fields.len())
                     }
                     Def::StructCtor(_, CtorKind::Fn) | Def::SelfCtor(..) => {
-                        match self.pat_ty_unadjusted(&pat)?.sty {
+                        let ty = self.pat_ty_unadjusted(&pat)?;
+                        match ty.sty {
                             ty::Adt(adt_def, _) => {
                                 (cmt, adt_def.non_enum_variant().fields.len())
                             }
-                            ref ty => {
+                            _ => {
                                 span_bug!(pat.span,
                                           "tuple struct pattern unexpected type {:?}", ty);
                             }
@@ -1334,9 +1336,10 @@ fn cat_pattern_<F>(&self, mut cmt: cmt<'tcx>, pat: &hir::Pat, op: &mut F) -> McR
 
             PatKind::Tuple(ref subpats, ddpos) => {
                 // (p1, ..., pN)
-                let expected_len = match self.pat_ty_unadjusted(&pat)?.sty {
+                let ty = self.pat_ty_unadjusted(&pat)?;
+                let expected_len = match ty.sty {
                     ty::Tuple(ref tys) => tys.len(),
-                    ref ty => span_bug!(pat.span, "tuple pattern unexpected type {:?}", ty),
+                    _ => span_bug!(pat.span, "tuple pattern unexpected type {:?}", ty),
                 };
                 for (i, subpat) in subpats.iter().enumerate_and_adjust(expected_len, ddpos) {
                     let subpat_ty = self.pat_ty_adjusted(&subpat)?; // see (*2)
index c7674ae7a28a248fc614ec3a885a2bda33d46212..0dd076481c88774908165e57608c3ea8e5f71b91 100644 (file)
@@ -854,10 +854,11 @@ pub fn report_selection_error(
                     _ => vec![ArgKind::empty()],
                 };
 
-                let expected = match expected_trait_ref.skip_binder().substs.type_at(1).sty {
+                let expected_ty = expected_trait_ref.skip_binder().substs.type_at(1);
+                let expected = match expected_ty.sty {
                     ty::Tuple(ref tys) => tys.iter()
                         .map(|t| ArgKind::from_expected_ty(t, Some(span))).collect(),
-                    ref sty => vec![ArgKind::Arg("_".to_owned(), sty.to_string())],
+                    _ => vec![ArgKind::Arg("_".to_owned(), expected_ty.to_string())],
                 };
 
                 if found.len() == expected.len() {
@@ -1686,10 +1687,10 @@ pub fn from_expected_ty(t: Ty<'_>, span: Option<Span>) -> ArgKind {
             ty::Tuple(ref tys) => ArgKind::Tuple(
                 span,
                 tys.iter()
-                   .map(|ty| ("_".to_owned(), ty.sty.to_string()))
+                   .map(|ty| ("_".to_owned(), ty.to_string()))
                    .collect::<Vec<_>>()
             ),
-            _ => ArgKind::Arg("_".to_owned(), t.sty.to_string()),
+            _ => ArgKind::Arg("_".to_owned(), t.to_string()),
         }
     }
 }
index 3a31801b3be39f2c0728007f0319d6e89d810317..b245d90379996951f6775dcac6ff099f77ebf859 100644 (file)
@@ -351,10 +351,8 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R,
     where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a
 {
     let tcx = relation.tcx();
-    let a_sty = &a.sty;
-    let b_sty = &b.sty;
-    debug!("super_relate_tys: a_sty={:?} b_sty={:?}", a_sty, b_sty);
-    match (a_sty, b_sty) {
+    debug!("super_relate_tys: a={:?} b={:?}", a, b);
+    match (&a.sty, &b.sty) {
         (&ty::Infer(_), _) |
         (_, &ty::Infer(_)) =>
         {
index 39728cc8cd5cba9916b691439f4cf3e5b26567e4..20acbb5b9c7122d37517bf21db7e1bcadeb66faf 100644 (file)
@@ -84,7 +84,7 @@ pub fn assert_bound_var(&self) -> BoundVar {
 
 /// N.B., if you change this, you'll probably want to change the corresponding
 /// AST structure in `libsyntax/ast.rs` as well.
-#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug,
+#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
          RustcEncodable, RustcDecodable, HashStable)]
 pub enum TyKind<'tcx> {
     /// The primitive boolean type. Written as `bool`.
@@ -383,9 +383,10 @@ pub fn closure_kind(self, def_id: DefId, tcx: TyCtxt<'_, 'tcx, 'tcx>) -> ty::Clo
     ///
     /// If you have an inference context, use `infcx.closure_sig()`.
     pub fn closure_sig(self, def_id: DefId, tcx: TyCtxt<'_, 'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> {
-        match self.closure_sig_ty(def_id, tcx).sty {
+        let ty = self.closure_sig_ty(def_id, tcx);
+        match ty.sty {
             ty::FnPtr(sig) => sig,
-            ref t => bug!("closure_sig_ty is not a fn-ptr: {:?}", t),
+            _ => bug!("closure_sig_ty is not a fn-ptr: {:?}", ty),
         }
     }
 }
index ff66df4e4a3f67733266af05c8d0d07c6dcea3ee..7f41947fbb929186cb1fdb7150fefd62ecad8cda 100644 (file)
@@ -1124,9 +1124,9 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 }
 
 define_print! {
-    ('tcx) ty::TyKind<'tcx>, (self, f, cx) {
+    ('tcx) ty::TyS<'tcx>, (self, f, cx) {
         display {
-            match *self {
+            match self.sty {
                 Bool => write!(f, "bool"),
                 Char => write!(f, "char"),
                 Int(t) => write!(f, "{}", t.ty_to_string()),
@@ -1376,16 +1376,8 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 }
             }
         }
-    }
-}
-
-define_print! {
-    ('tcx) ty::TyS<'tcx>, (self, f, cx) {
-        display {
-            self.sty.print(f, cx)
-        }
         debug {
-            self.sty.print_display(f, cx)
+            self.print_display(f, cx)
         }
     }
 }
index 3268af396a2f4f475c2353b3ed76ea66083c8ec9..12edb3a090712b471a09d883662c924bb84697b9 100644 (file)
@@ -513,8 +513,7 @@ fn codegen_intrinsic_call(
 
             },
             "fadd_fast" | "fsub_fast" | "fmul_fast" | "fdiv_fast" | "frem_fast" => {
-                let sty = &arg_tys[0].sty;
-                match float_type_width(sty) {
+                match float_type_width(arg_tys[0]) {
                     Some(_width) =>
                         match name {
                             "fadd_fast" => self.fadd_fast(args[0].immediate(), args[1].immediate()),
@@ -528,7 +527,7 @@ fn codegen_intrinsic_call(
                         span_invalid_monomorphization_error(
                             tcx.sess, span,
                             &format!("invalid monomorphization of `{}` intrinsic: \
-                                      expected basic float type, found `{}`", name, sty));
+                                      expected basic float type, found `{}`", name, arg_tys[0]));
                         return;
                     }
                 }
@@ -1473,8 +1472,8 @@ fn non_ptr(t: ty::Ty<'_>) -> ty::Ty<'_> {
                 require!(false, "expected element type `{}` of second argument `{}` \
                                  to be a pointer to the element type `{}` of the first \
                                  argument `{}`, found `{}` != `*_ {}`",
-                         arg_tys[1].simd_type(tcx).sty, arg_tys[1], in_elem, in_ty,
-                         arg_tys[1].simd_type(tcx).sty, in_elem);
+                         arg_tys[1].simd_type(tcx), arg_tys[1], in_elem, in_ty,
+                         arg_tys[1].simd_type(tcx), in_elem);
                 unreachable!();
             }
         };
@@ -1488,7 +1487,7 @@ fn non_ptr(t: ty::Ty<'_>) -> ty::Ty<'_> {
             _ => {
                 require!(false, "expected element type `{}` of third argument `{}` \
                                  to be a signed integer type",
-                         arg_tys[2].simd_type(tcx).sty, arg_tys[2]);
+                         arg_tys[2].simd_type(tcx), arg_tys[2]);
             }
         }
 
@@ -1573,8 +1572,8 @@ fn non_ptr(t: ty::Ty<'_>) -> ty::Ty<'_> {
                 require!(false, "expected element type `{}` of second argument `{}` \
                                  to be a pointer to the element type `{}` of the first \
                                  argument `{}`, found `{}` != `*mut {}`",
-                         arg_tys[1].simd_type(tcx).sty, arg_tys[1], in_elem, in_ty,
-                         arg_tys[1].simd_type(tcx).sty, in_elem);
+                         arg_tys[1].simd_type(tcx), arg_tys[1], in_elem, in_ty,
+                         arg_tys[1].simd_type(tcx), in_elem);
                 unreachable!();
             }
         };
@@ -1588,7 +1587,7 @@ fn non_ptr(t: ty::Ty<'_>) -> ty::Ty<'_> {
             _ => {
                 require!(false, "expected element type `{}` of third argument `{}` \
                                  to be a signed integer type",
-                         arg_tys[2].simd_type(tcx).sty, arg_tys[2]);
+                         arg_tys[2].simd_type(tcx), arg_tys[2]);
             }
         }
 
@@ -1954,10 +1953,10 @@ fn int_type_width_signed(ty: Ty<'_>, cx: &CodegenCx<'_, '_>) -> Option<(u64, boo
     }
 }
 
-// Returns the width of a float TypeVariant
+// Returns the width of a float Ty
 // Returns None if the type is not a float
-fn float_type_width<'tcx>(sty: &ty::TyKind<'tcx>) -> Option<u64> {
-    match *sty {
+fn float_type_width(ty: Ty) -> Option<u64> {
+    match ty.sty {
         ty::Float(t) => Some(t.bit_width() as u64),
         _ => None,
     }
index 349c9132842b893947cd5434e4edc2f364d68d47..2bb68dc687ca9c849661450dabc8eb91eba5e215 100644 (file)
@@ -53,7 +53,7 @@ pub fn simd_shuffle_indices(
                 let field_ty = c.ty.builtin_index().unwrap();
                 let fields = match c.ty.sty {
                     ty::Array(_, n) => n.unwrap_usize(bx.tcx()),
-                    ref other => bug!("invalid simd shuffle type: {}", other),
+                    _ => bug!("invalid simd shuffle type: {}", c.ty),
                 };
                 let values: Vec<_> = (0..fields).map(|field| {
                     let field = const_field(
index 7c5e615f22452dbb02f72f283560a7c0765f032d..fe00276a55a45f25ae7064ea417f45f7cc7d071b 100644 (file)
@@ -148,7 +148,7 @@ fn type_has_metadata(&self, ty: Ty<'tcx>) -> bool {
         match tail.sty {
             ty::Foreign(..) => false,
             ty::Str | ty::Slice(..) | ty::Dynamic(..) => true,
-            _ => bug!("unexpected unsized tail: {:?}", tail.sty),
+            _ => bug!("unexpected unsized tail: {:?}", tail),
         }
     }
 }
index fe07cc0698a0a0e4f17c6f8e201e3919fa4f75f2..aa3750946d366cf879d9f66f1b90c40acd04f9c2 100644 (file)
@@ -1799,7 +1799,7 @@ fn describe_field_from_ty(&self, ty: &ty::Ty<'_>, field: Field) -> String {
                     // (https://github.com/rust-lang/rfcs/pull/1546)
                     bug!(
                         "End-user description not implemented for field access on `{:?}`",
-                        ty.sty
+                        ty
                     );
                 }
             }
index 7749b3a5ca49e893bab536bbbf4f5c06134ebc67..c8c6d73d4536a4267b2537f990a55c867ec248d3 100644 (file)
@@ -955,7 +955,8 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
             let user_provided_types = cx.tables.user_provided_types();
             let user_provided_type = user_provided_types.get(expr.hir_id).map(|u_ty| *u_ty);
             debug!("convert_path_expr: user_provided_type={:?}", user_provided_type);
-            match cx.tables().node_type(expr.hir_id).sty {
+            let ty = cx.tables().node_type(expr.hir_id);
+            match ty.sty {
                 // A unit struct/variant which is used as a value.
                 // We return a completely different ExprKind here to account for this special case.
                 ty::Adt(adt_def, substs) => {
@@ -968,7 +969,7 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
                         base: None,
                     }
                 }
-                ref sty => bug!("unexpected sty: {:?}", sty),
+                _ => bug!("unexpected ty: {:?}", ty),
             }
         }
 
index 67d40197290f17bb600725413b2b63c494c5f05a..8aa4fdedc18e2a89cb2dae6ec066c0af58c03c49 100644 (file)
@@ -529,11 +529,11 @@ fn lower_pattern_unadjusted(&mut self, pat: &'tcx hir::Pat) -> Pattern<'tcx> {
                     ty::Error => { // Avoid ICE
                         return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) };
                     }
-                    ref sty =>
+                    _ =>
                         span_bug!(
                             pat.span,
                             "unexpanded type for vector pattern: {:?}",
-                            sty),
+                            ty),
                 }
             }
 
@@ -554,7 +554,7 @@ fn lower_pattern_unadjusted(&mut self, pat: &'tcx hir::Pat) -> Pattern<'tcx> {
                     ty::Error => { // Avoid ICE (#50577)
                         return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) };
                     }
-                    ref sty => span_bug!(pat.span, "unexpected type for tuple pattern: {:?}", sty),
+                    _ => span_bug!(pat.span, "unexpected type for tuple pattern: {:?}", ty),
                 }
             }
 
@@ -608,7 +608,7 @@ fn lower_pattern_unadjusted(&mut self, pat: &'tcx hir::Pat) -> Pattern<'tcx> {
                     }
                     _ => span_bug!(pat.span,
                                    "tuple struct pattern not applied to an ADT {:?}",
-                                   ty.sty),
+                                   ty),
                 };
                 let variant_def = adt_def.variant_of_def(def);
 
@@ -744,7 +744,7 @@ fn lower_variant_or_leaf(
                         ty::Error => {  // Avoid ICE (#50585)
                             return PatternKind::Wild;
                         }
-                        _ => bug!("inappropriate type for def: {:?}", ty.sty),
+                        _ => bug!("inappropriate type for def: {:?}", ty),
                     };
                     PatternKind::Variant {
                         adt_def,
index 4618cd42686fa2e4ffb251e6185051d5a412fc84..c9dae6990795be5276853a93cb49bfff621cb810 100644 (file)
@@ -16,7 +16,8 @@ fn user_substs_applied_to_ty_of_hir_id(
         let user_provided_types = self.tables().user_provided_types();
         let mut user_ty = *user_provided_types.get(hir_id)?;
         debug!("user_subts_applied_to_ty_of_hir_id: user_ty={:?}", user_ty);
-        match &self.tables().node_type(hir_id).sty {
+        let ty = self.tables().node_type(hir_id);
+        match ty.sty {
             ty::Adt(adt_def, ..) => {
                 if let UserType::TypeOf(ref mut did, _) = &mut user_ty.value {
                     *did = adt_def.did;
@@ -24,8 +25,11 @@ fn user_substs_applied_to_ty_of_hir_id(
                 Some(user_ty)
             }
             ty::FnDef(..) => Some(user_ty),
-            sty =>
-                bug!("sty: {:?} should not have user provided type {:?} recorded ", sty, user_ty),
+            _ => bug!(
+                "ty: {:?} should not have user provided type {:?} recorded ",
+                ty,
+                user_ty
+            ),
         }
     }
 }
index 73c73cc23dcf0cc90dd98f0440075c0882aab228..7543dd678d032fdd9a3f730ea0845ae4708a52e4 100644 (file)
@@ -90,7 +90,7 @@ pub fn cast(
                         let fn_ptr = self.memory.create_fn_alloc(instance?).with_default_tag();
                         self.write_scalar(Scalar::Ptr(fn_ptr.into()), dest)?;
                     }
-                    ref other => bug!("reify fn pointer on {:?}", other),
+                    _ => bug!("reify fn pointer on {:?}", src.layout.ty),
                 }
             }
 
@@ -101,7 +101,7 @@ pub fn cast(
                         // No change to value
                         self.write_immediate(*src, dest)?;
                     }
-                    ref other => bug!("fn to unsafe fn cast on {:?}", other),
+                    _ => bug!("fn to unsafe fn cast on {:?}", dest.layout.ty),
                 }
             }
 
@@ -120,7 +120,7 @@ pub fn cast(
                         let val = Immediate::Scalar(Scalar::Ptr(fn_ptr.into()).into());
                         self.write_immediate(val, dest)?;
                     }
-                    ref other => bug!("closure fn pointer on {:?}", other),
+                    _ => bug!("closure fn pointer on {:?}", src.layout.ty),
                 }
             }
         }
index b3b9c742d6c282bc020aaaa879d3a07d9029da3b..944e393d296fc9e172d3205d660c21e4475b1988 100644 (file)
@@ -336,7 +336,7 @@ pub fn unary_op(
 
         let layout = val.layout;
         let val = val.to_scalar()?;
-        trace!("Running unary op {:?}: {:?} ({:?})", un_op, val, layout.ty.sty);
+        trace!("Running unary op {:?}: {:?} ({:?})", un_op, val, layout.ty);
 
         match layout.ty.sty {
             ty::Bool => {
index 4df274bc9df97409db818583209e3706f7db4953..755bbd96b02f9131b1d75b2e8020bb643c1f265d 100644 (file)
@@ -354,7 +354,7 @@ pub fn deref_operand(
             ty::Ref(_, _, mutbl) => Some(mutbl),
             ty::Adt(def, _) if def.is_box() => Some(hir::MutMutable),
             ty::RawPtr(_) => None,
-            _ => bug!("Unexpected pointer type {}", val.layout.ty.sty),
+            _ => bug!("Unexpected pointer type {}", val.layout.ty),
         };
         place.mplace.ptr = M::tag_dereference(self, place, mutbl)?;
         Ok(place)
index 1e245faddf04c9814b1c20852e42f8d50852df70..bfdf34f3e37e49a5c938bb184004a0e74992d568 100644 (file)
@@ -836,7 +836,7 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             match tail.sty {
                 ty::Foreign(..) => false,
                 ty::Str | ty::Slice(..) | ty::Dynamic(..) => true,
-                _ => bug!("unexpected unsized tail: {:?}", tail.sty),
+                _ => bug!("unexpected unsized tail: {:?}", tail),
             }
         };
         if type_has_metadata(inner_source) {
index 89ec92a652160940916a66615dfd96c81843a247..fd09ce7f689b5f52c2aeb461c7e9344848ba2ebf 100644 (file)
@@ -959,7 +959,9 @@ fn ast_path_to_ty(&self,
     /// removing the dummy `Self` type (`TRAIT_OBJECT_DUMMY_SELF`).
     fn trait_ref_to_existential(&self, trait_ref: ty::TraitRef<'tcx>)
                                 -> ty::ExistentialTraitRef<'tcx> {
-        assert_eq!(trait_ref.self_ty().sty, TRAIT_OBJECT_DUMMY_SELF);
+        if trait_ref.self_ty().sty != TRAIT_OBJECT_DUMMY_SELF {
+            bug!("trait_ref_to_existential called on {:?} with non-dummy Self", trait_ref);
+        }
         ty::ExistentialTraitRef::erase_self_ty(self.tcx(), trait_ref)
     }
 
index 1a3ade7f8baf6b7d8672af00a834eabdd2fb0892..342a214e0cc229d9e1d9652eaaa3a8e20d6288e6 100644 (file)
@@ -88,7 +88,7 @@ pub fn check_pat_walk(
             // See the examples in `run-pass/match-defbm*.rs`.
             let mut pat_adjustments = vec![];
             while let ty::Ref(_, inner_ty, inner_mutability) = exp_ty.sty {
-                debug!("inspecting {:?} with type {:?}", exp_ty, exp_ty.sty);
+                debug!("inspecting {:?}", exp_ty);
 
                 debug!("current discriminant is Ref, inserting implicit deref");
                 // Preserve the reference type. We'll need it later during HAIR lowering.
@@ -894,7 +894,7 @@ fn check_pat_tuple_struct(
                 subpats.len() < variant.fields.len() && ddpos.is_some() {
             let substs = match pat_ty.sty {
                 ty::Adt(_, substs) => substs,
-                ref ty => bug!("unexpected pattern type {:?}", ty),
+                _ => bug!("unexpected pattern type {:?}", pat_ty),
             };
             for (i, subpat) in subpats.iter().enumerate_and_adjust(variant.fields.len(), ddpos) {
                 let field_ty = self.field_ty(subpat.span, &variant.fields[i], substs);
index 28c79ce0c74e86c77ad9634838a21a9a9f8b061f..c40bdae0762a96b29ae3d1f3a8f9a91671f91ce4 100644 (file)
@@ -3885,7 +3885,7 @@ pub fn check_struct_path(&self,
                     ty::Adt(adt, substs) => {
                         Some((adt.variant_of_def(def), adt.did, substs))
                     }
-                    _ => bug!("unexpected type: {:?}", ty.sty)
+                    _ => bug!("unexpected type: {:?}", ty)
                 }
             }
             Def::Struct(..) | Def::Union(..) | Def::TyAlias(..) |
@@ -5226,8 +5226,8 @@ fn suggest_missing_return_type(
                 debug!("suggest_missing_return_type: return type {:?} node {:?}", ty, ty.node);
                 let sp = ty.span;
                 let ty = AstConv::ast_ty_to_ty(self, ty);
-                debug!("suggest_missing_return_type: return type sty {:?}", ty.sty);
-                debug!("suggest_missing_return_type: expected type sty {:?}", ty.sty);
+                debug!("suggest_missing_return_type: return type {:?}", ty);
+                debug!("suggest_missing_return_type: expected type {:?}", ty);
                 if ty.sty == expected.sty {
                     err.span_label(sp, format!("expected `{}` because of return type",
                                                expected));
index 3e6e6576b63ba3c4dd1cded29c86bfb7dd28b4df..a76dfdd69ba9797304da44193f7093b797910962 100644 (file)
@@ -93,19 +93,20 @@ fn analyze_closure(
         );
 
         // Extract the type of the closure.
-        let (closure_def_id, substs) = match self.node_ty(closure_hir_id).sty {
+        let ty = self.node_ty(closure_hir_id);
+        let (closure_def_id, substs) = match ty.sty {
             ty::Closure(def_id, substs) => (def_id, UpvarSubsts::Closure(substs)),
             ty::Generator(def_id, substs, _) => (def_id, UpvarSubsts::Generator(substs)),
             ty::Error => {
                 // #51714: skip analysis when we have already encountered type errors
                 return;
             }
-            ref t => {
+            _ => {
                 span_bug!(
                     span,
                     "type of closure expr {:?} is not a closure {:?}",
                     closure_hir_id,
-                    t
+                    ty
                 );
             }
         };
index fde940eb2c111fe1f92384ae86d17a8da2117dc4..92c44e24998e5de692a8d7fb7a0b8e51ba7e116e 100644 (file)
@@ -618,7 +618,7 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>(
     span: Span,
     ty: Ty<'tcx>,
 ) -> Vec<ty::Predicate<'tcx>> {
-    trace!("check_existential_types: {:?}, {:?}", ty, ty.sty);
+    trace!("check_existential_types: {:?}", ty);
     let mut substituted_predicates = Vec::new();
     ty.fold_with(&mut ty::fold::BottomUpFolder {
         tcx: fcx.tcx,
index d001545d1d9152e345a6a9e5e2c9de4c7fb89b09..4a3d4f31a24731eed44d220ea783e4adb3f47ed6 100644 (file)
@@ -472,7 +472,7 @@ fn visit_opaque_types(&mut self, span: Span) {
                 instantiated_ty.fold_with(&mut BottomUpFolder {
                     tcx: self.tcx().global_tcx(),
                     fldop: |ty| {
-                        trace!("checking type {:?}: {:#?}", ty, ty.sty);
+                        trace!("checking type {:?}", ty);
                         // find a type parameter
                         if let ty::Param(..) = ty.sty {
                             // look it up in the substitution list