Skip to content

Commit 496f26c

Browse files
committed
Auto merge of #8287 - Jarcho:iter_not_returning_iterator_8285, r=Manishearth
Erase late bound regions in `iter_not_returning_iterator` fixes #8285 changelog: None
2 parents 7a4acf9 + 70a6d7b commit 496f26c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

clippy_lints/src/iter_not_returning_iterator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'tcx> LateLintPass<'tcx> for IterNotReturningIterator {
6666

6767
fn check_sig(cx: &LateContext<'_>, name: &str, sig: &FnSig<'_>, fn_id: LocalDefId) {
6868
if sig.decl.implicit_self.has_implicit_self() {
69-
let ret_ty = cx.tcx.fn_sig(fn_id).skip_binder().output();
69+
let ret_ty = cx.tcx.erase_late_bound_regions(cx.tcx.fn_sig(fn_id).output());
7070
let ret_ty = cx
7171
.tcx
7272
.try_normalize_erasing_regions(cx.param_env, ret_ty)

tests/ui/iter_not_returning_iterator.rs

+7
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,11 @@ impl S {
6464
}
6565
}
6666

67+
struct S2([u8]);
68+
impl S2 {
69+
fn iter(&self) -> core::slice::Iter<u8> {
70+
self.0.iter()
71+
}
72+
}
73+
6774
fn main() {}

0 commit comments

Comments
 (0)