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
+ .try_normalize_erasing_regions(cx.param_env, ret_ty)
+ .unwrap_or(ret_ty);
if cx
.tcx
.get_diagnostic_item(sym::Iterator)
}
}
+// Issue #8225
trait Iter {
type I;
fn iter(&self) -> Self::I;
}
}
+struct S;
+impl S {
+ fn iter(&self) -> <() as Iter>::I {
+ ().iter()
+ }
+}
+
fn main() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this method is named `iter` but its return type does not implement `Iterator`
- --> $DIR/iter_not_returning_iterator.rs:49:5
+ --> $DIR/iter_not_returning_iterator.rs:50:5
|
LL | fn iter(&self) -> Self::I;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^