Add more tests + visit_ty in some places

This commit is contained in:
Ellen
2021-06-09 19:28:41 +01:00
parent 8e7299dfcd
commit c318364d48
6 changed files with 62 additions and 21 deletions

View File

@@ -97,10 +97,19 @@ pub fn is_const_evaluatable<'cx, 'tcx>(
ControlFlow::CONTINUE
}
Node::Binop(_, _, _)
| Node::UnaryOp(_, _)
| Node::FunctionCall(_, _)
| Node::Cast(_, _, _) => ControlFlow::CONTINUE,
Node::Cast(_, _, ty) => {
let ty = ty.subst(tcx, ct.substs);
if ty.has_infer_types_or_consts() {
failure_kind = FailureKind::MentionsInfer;
} else if ty.has_param_types_or_consts() {
failure_kind = cmp::min(failure_kind, FailureKind::MentionsParam);
}
ControlFlow::CONTINUE
}
Node::Binop(_, _, _) | Node::UnaryOp(_, _) | Node::FunctionCall(_, _) => {
ControlFlow::CONTINUE
}
});
match failure_kind {