Skip to content

Commit 2a3c5d9

Browse files
committed
add util method Ty::pointee
1 parent 76ce0f4 commit 2a3c5d9

File tree

1 file changed

+7
-0
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+7
-0
lines changed

compiler/rustc_middle/src/ty/util.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,13 @@ impl<'tcx> Ty<'tcx> {
15551555
ty
15561556
}
15571557

1558+
pub fn pointee(self) -> Ty<'tcx> {
1559+
match *self.kind() {
1560+
ty::RawPtr(ty, _) => ty,
1561+
_ => bug!("pointee called on non-pointer type: {:?}", self),
1562+
}
1563+
}
1564+
15581565
// FIXME(compiler-errors): Think about removing this.
15591566
#[inline]
15601567
pub fn outer_exclusive_binder(self) -> ty::DebruijnIndex {

0 commit comments

Comments
 (0)