Skip to content

Commit

Permalink
Auto merge of #8287 - Jarcho:iter_not_returning_iterator_8285, r=Mani…
Browse files Browse the repository at this point in the history
…shearth

Erase late bound regions in `iter_not_returning_iterator`

fixes #8285

changelog: None
  • Loading branch information
bors committed Jan 15, 2022
2 parents 7a4acf9 + 70a6d7b commit 496f26c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_lints/src/iter_not_returning_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl<'tcx> LateLintPass<'tcx> for IterNotReturningIterator {

fn check_sig(cx: &LateContext<'_>, name: &str, sig: &FnSig<'_>, fn_id: LocalDefId) {
if sig.decl.implicit_self.has_implicit_self() {
let ret_ty = cx.tcx.fn_sig(fn_id).skip_binder().output();
let ret_ty = cx.tcx.erase_late_bound_regions(cx.tcx.fn_sig(fn_id).output());
let ret_ty = cx
.tcx
.try_normalize_erasing_regions(cx.param_env, ret_ty)
Expand Down
7 changes: 7 additions & 0 deletions tests/ui/iter_not_returning_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,11 @@ impl S {
}
}

struct S2([u8]);
impl S2 {
fn iter(&self) -> core::slice::Iter<u8> {
self.0.iter()
}
}

fn main() {}

0 comments on commit 496f26c

Please sign in to comment.