Files
rust/tests/ui/impl-trait/non-defining-uses/recursive-call.rs
lcnr b8160e9f38 use defining uses of all bodies to constrain non-defining uses
support non-defining uses in closures
2025-09-01 22:08:03 +02:00

31 lines
652 B
Rust

//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)
//@ check-pass
// Regression test for the non-defining use error in `gll`.
struct Foo;
impl Foo {
fn recur(&self, b: bool) -> impl Sized + '_ {
if b {
let temp = Foo;
temp.recur(false);
// desugars to `Foo::recur(&temp);`
}
self
}
fn in_closure(&self) -> impl Sized + '_ {
let _ = || {
let temp = Foo;
temp.in_closure();
// desugars to `Foo::in_closure(&temp);`
};
self
}
}
fn main() {}