Merge branch 'master' into sugg

This commit is contained in:
mcarton
2016-07-03 23:56:06 +02:00
11 changed files with 237 additions and 38 deletions

View File

@@ -714,3 +714,12 @@ pub fn same_tys<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, a: ty::Ty<'tcx>, b: ty::Ty
infcx.can_equate(&new_a, &new_b).is_ok()
})
}
/// Return whether the given type is an `unsafe` function.
pub fn type_is_unsafe_function(ty: ty::Ty) -> bool {
match ty.sty {
ty::TyFnDef(_, _, ref f) |
ty::TyFnPtr(ref f) => f.unsafety == Unsafety::Unsafe,
_ => false,
}
}