Skip to content

Commit 282b231

Browse files
MaikKleinarielb1
authored andcommitted
Move has_metadata back to context.rs
1 parent 6e94a7a commit 282b231

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

src/librustc/ty/mod.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,20 +2040,6 @@ impl<'tcx> TyS<'tcx> {
20402040
}
20412041
}
20422042
}
2043-
2044-
pub fn has_metadata<'a>(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> bool {
2045-
use syntax_pos::DUMMY_SP;
2046-
if self.is_sized(tcx, ty::ParamEnv::empty(traits::Reveal::All), DUMMY_SP) {
2047-
return false;
2048-
}
2049-
2050-
let tail = tcx.struct_tail(self);
2051-
match tail.sty {
2052-
ty::TyForeign(..) => false,
2053-
ty::TyStr | ty::TySlice(..) | ty::TyDynamic(..) => true,
2054-
_ => bug!("unexpected unsized tail: {:?}", tail.sty),
2055-
}
2056-
}
20572043
}
20582044

20592045
#[derive(Copy, Clone, Debug, PartialEq, Eq)]

src/librustc_trans/context.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,17 @@ impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> {
324324
}
325325

326326
pub fn type_has_metadata(&self, ty: Ty<'tcx>) -> bool {
327-
ty.has_metadata(self.tcx)
327+
use syntax_pos::DUMMY_SP;
328+
if ty.is_sized(self.tcx, ty::ParamEnv::empty(traits::Reveal::All), DUMMY_SP) {
329+
return false;
330+
}
331+
332+
let tail = self.tcx.struct_tail(ty);
333+
match tail.sty {
334+
ty::TyForeign(..) => false,
335+
ty::TyStr | ty::TySlice(..) | ty::TyDynamic(..) => true,
336+
_ => bug!("unexpected unsized tail: {:?}", tail.sty),
337+
}
328338
}
329339

330340
pub fn tcx(&self) -> TyCtxt<'b, 'tcx, 'tcx> {

0 commit comments

Comments
 (0)