Skip to content

Commit

Permalink
Update trait check
Browse files Browse the repository at this point in the history
  • Loading branch information
mejrs committed Nov 29, 2022
1 parent 4ced370 commit b209ff2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,10 +769,13 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
// 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;
}
}
Expand Down

0 comments on commit b209ff2

Please sign in to comment.