Files
rust/tests/ui/impl-trait/method/method-resolution4.rs

19 lines
507 B
Rust
Raw Permalink Normal View History

2024-04-15 11:20:33 +00:00
//! The recursive method call yields the opaque type. The
//! `next` method call then constrains the hidden type to `&mut _`
//! because `next` takes `&mut self`. We never resolve the inference
//! variable, but get a type mismatch when comparing `&mut _` with
//! `std::iter::Empty`.
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
2025-09-23 17:33:24 +02:00
//@ check-pass
2024-04-15 11:20:33 +00:00
fn foo(b: bool) -> impl Iterator<Item = ()> {
if b {
foo(false).next().unwrap();
}
std::iter::empty()
}
fn main() {}