]> git.lizzy.rs Git - rust.git/commitdiff
Move has_metadata back to context.rs
authorMaik Klein <maikklein@googlemail.com>
Thu, 23 Nov 2017 14:05:55 +0000 (15:05 +0100)
committerAriel Ben-Yehuda <ariel.byd@gmail.com>
Mon, 18 Dec 2017 15:08:49 +0000 (17:08 +0200)
src/librustc/ty/mod.rs
src/librustc_trans/context.rs

index 85f3d692bbeb7cfab78b3fea49a98665b1a06c1e..220e1e971accd5362f019987f7993b9521e69f47 100644 (file)
@@ -2040,20 +2040,6 @@ pub fn maybe_walk<F>(&'tcx self, mut f: F)
             }
         }
     }
-
-    pub fn has_metadata<'a>(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> bool {
-        use syntax_pos::DUMMY_SP;
-        if self.is_sized(tcx, ty::ParamEnv::empty(traits::Reveal::All), DUMMY_SP) {
-            return false;
-        }
-
-        let tail = tcx.struct_tail(self);
-        match tail.sty {
-            ty::TyForeign(..) => false,
-            ty::TyStr | ty::TySlice(..) | ty::TyDynamic(..) => true,
-            _ => bug!("unexpected unsized tail: {:?}", tail.sty),
-        }
-    }
 }
 
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
index f04381aa212be241ade8c39568eb409c7a8def2a..5ecc3fb4ebe3a86cadd9c78bb7151f90003fd09a 100644 (file)
@@ -324,7 +324,17 @@ pub fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
     }
 
     pub fn type_has_metadata(&self, ty: Ty<'tcx>) -> bool {
-        ty.has_metadata(self.tcx)
+        use syntax_pos::DUMMY_SP;
+        if ty.is_sized(self.tcx, ty::ParamEnv::empty(traits::Reveal::All), DUMMY_SP) {
+            return false;
+        }
+
+        let tail = self.tcx.struct_tail(ty);
+        match tail.sty {
+            ty::TyForeign(..) => false,
+            ty::TyStr | ty::TySlice(..) | ty::TyDynamic(..) => true,
+            _ => bug!("unexpected unsized tail: {:?}", tail.sty),
+        }
     }
 
     pub fn tcx(&self) -> TyCtxt<'b, 'tcx, 'tcx> {