rust/tests/ui/regions/account-for-lifetimes-in-closure-suggestion.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
391 B
Rust
Raw Normal View History

// #125634
struct Thing;
// Invariant in 'a, Covariant in 'b
struct TwoThings<'a, 'b>(*mut &'a (), &'b mut ());
impl Thing {
fn enter_scope<'a>(self, _scope: impl for<'b> FnOnce(TwoThings<'a, 'b>)) {}
}
fn foo() {
Thing.enter_scope(|ctx| {
SameLifetime(ctx); //~ ERROR lifetime may not live long enough
});
}
struct SameLifetime<'a>(TwoThings<'a, 'a>);
fn main() {}