]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-escape-method.rs
Auto merge of #56951 - oli-obk:auto_toolstate_issue, r=kennytm
[rust.git] / src / test / ui / regions / regions-escape-method.rs
1 // Test a method call where the parameter `B` would (illegally) be
2 // inferred to a region bound in the method argument. If this program
3 // were accepted, then the closure passed to `s.f` could escape its
4 // argument.
5
6 struct S;
7
8 impl S {
9     fn f<B, F>(&self, _: F) where F: FnOnce(&i32) -> B {
10     }
11 }
12
13 fn main() {
14     let s = S;
15     s.f(|p| p) //~ ERROR cannot infer
16 }