move walk_ty() to utils module and rename to walk_ptrs_ty

This commit is contained in:
Georg Brandl
2015-08-11 20:57:21 +02:00
parent 6bc69fa342
commit cf96042c65
4 changed files with 16 additions and 17 deletions

View File

@@ -84,3 +84,11 @@ pub fn span_help_and_lint(cx: &Context, lint: &'static Lint, span: Span,
cx.sess().fileline_help(span, help);
}
}
/// return the base type for references and raw pointers
pub fn walk_ptrs_ty<'t>(ty: ty::Ty<'t>) -> ty::Ty<'t> {
match ty.sty {
ty::TyRef(_, ref tm) | ty::TyRawPtr(ref tm) => walk_ptrs_ty(tm.ty),
_ => ty
}
}