Fix FP in REDUNDANT_CLOSURE with divergent functions

This commit is contained in:
mcarton 2016-03-30 23:07:21 +02:00
parent f98e3ecb37
commit 7095b5df31
2 changed files with 18 additions and 1 deletions

View file

@ -61,7 +61,8 @@ fn check_closure(cx: &LateContext, expr: &Expr) {
match fn_ty.sty {
// Is it an unsafe function? They don't implement the closure traits
ty::TyFnDef(_, _, fn_ty) | ty::TyFnPtr(fn_ty) => {
if fn_ty.unsafety == Unsafety::Unsafe {
if fn_ty.unsafety == Unsafety::Unsafe ||
fn_ty.sig.skip_binder().output == ty::FnOutput::FnDiverging {
return;
}
}