Mark some once-again-unreachable paths as unreachable.

This undoes the changes from #121482 and #121586, now that stashed errors
will trigger more early aborts.
This commit is contained in:
Nicholas Nethercote 2024-02-27 15:02:54 +11:00
parent 260ae70140
commit b4e9f93eb4
2 changed files with 6 additions and 13 deletions

View file

@ -70,15 +70,11 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
// Check if the method call actually calls the libcore
// `IntoIterator::into_iter`.
let trait_id = cx
.typeck_results()
.type_dependent_def_id(expr.hir_id)
.and_then(|did| cx.tcx.trait_of_item(did));
if trait_id.is_none()
|| !cx.tcx.is_diagnostic_item(sym::IntoIterator, trait_id.unwrap())
{
return;
}
let def_id = cx.typeck_results().type_dependent_def_id(expr.hir_id).unwrap();
match cx.tcx.trait_of_item(def_id) {
Some(trait_id) if cx.tcx.is_diagnostic_item(sym::IntoIterator, trait_id) => {}
_ => return,
};
// As this is a method call expression, we have at least one argument.
let receiver_ty = cx.typeck_results().expr_ty(receiver_arg);