]> git.lizzy.rs Git - rust.git/commitdiff
Compare `Ty`s directly instead of their `TyKind`s
authorflip1995 <hello@philkrones.com>
Wed, 3 Apr 2019 14:08:04 +0000 (16:08 +0200)
committerflip1995 <hello@philkrones.com>
Wed, 3 Apr 2019 17:18:07 +0000 (19:18 +0200)
src/librustc_typeck/astconv.rs

index ab5c2fee0ae0bb879188bbea33def72453e3ea21..8805dade40e4c2a5d2a1fadd5c8caf0f4a9236e9 100644 (file)
@@ -591,7 +591,7 @@ fn create_substs_for_ast_path(&self,
         );
 
         let is_object = self_ty.map_or(false, |ty| {
-            ty.sty == self.tcx().types.trait_object_dummy_self.sty
+            ty == self.tcx().types.trait_object_dummy_self
         });
         let default_needs_object_self = |param: &ty::GenericParamDef| {
             if let GenericParamDefKind::Type { has_default, .. } = param.kind {
@@ -956,7 +956,7 @@ 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> {
-        if trait_ref.self_ty().sty != self.tcx().types.trait_object_dummy_self.sty {
+        if trait_ref.self_ty() != self.tcx().types.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)