Update trait check
This commit is contained in:
parent
4ced370f7c
commit
b209ff27f3
@ -769,10 +769,13 @@ fn check_item(&mut self, cx: &LateContext<'_>, item: &hir::Item<'_>) {
|
||||
// We shouldn't recommend implementing `Copy` on stateful things,
|
||||
// such as iterators.
|
||||
if let Some(iter_trait) = cx.tcx.get_diagnostic_item(sym::Iterator) {
|
||||
if cx.tcx.infer_ctxt().enter(|infer_ctxt| {
|
||||
infer_ctxt.type_implements_trait(iter_trait, ty, List::empty(), param_env)
|
||||
== EvaluationResult::EvaluatedToOk
|
||||
}) {
|
||||
if cx.tcx.infer_ctxt().build().type_implements_trait(
|
||||
iter_trait,
|
||||
ty,
|
||||
List::empty(),
|
||||
param_env,
|
||||
) == EvaluationResult::EvaluatedToOk
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user