1 #![allow(dead_code, non_camel_case_types)]
3 // Test that bounds on higher-kinded lifetime binders are rejected.
8 f: for<'xa, 'xb: 'xa+'xa> fn(&'xa i32, &'xb i32) -> &'xa i32)
9 //~^ ERROR lifetime bounds cannot be used in this context
11 // If the bound in f's type would matter, the call below would (have to)
16 fn bar2<'a, 'b, F: for<'xa, 'xb: 'xa> Fn(&'xa i32, &'xb i32) -> &'xa i32>(
17 //~^ ERROR lifetime bounds cannot be used in this context
22 // If the bound in f's type would matter, the call below would (have to)
31 where F: for<'xa, 'xb: 'xa> Fn(&'xa i32, &'xb i32) -> &'xa i32
32 //~^ ERROR lifetime bounds cannot be used in this context
34 // If the bound in f's type would matter, the call below would (have to)
43 where for<'xa, 'xb: 'xa> F: Fn(&'xa i32, &'xb i32) -> &'xa i32
44 //~^ ERROR lifetime bounds cannot be used in this context
46 // If the bound in f's type would matter, the call below would (have to)
51 struct S1<F: for<'xa, 'xb: 'xa> Fn(&'xa i32, &'xb i32) -> &'xa i32>(F);
52 //~^ ERROR lifetime bounds cannot be used in this context
53 struct S2<F>(F) where F: for<'xa, 'xb: 'xa> Fn(&'xa i32, &'xb i32) -> &'xa i32;
54 //~^ ERROR lifetime bounds cannot be used in this context
55 struct S3<F>(F) where for<'xa, 'xb: 'xa> F: Fn(&'xa i32, &'xb i32) -> &'xa i32;
56 //~^ ERROR lifetime bounds cannot be used in this context
58 struct S_fnty(for<'xa, 'xb: 'xa> fn(&'xa i32, &'xb i32) -> &'xa i32);
59 //~^ ERROR lifetime bounds cannot be used in this context
61 type T1 = Box<dyn for<'xa, 'xb: 'xa> Fn(&'xa i32, &'xb i32) -> &'xa i32>;
62 //~^ ERROR lifetime bounds cannot be used in this context
65 let _ : Option<for<'xa, 'xb: 'xa> fn(&'xa i32, &'xb i32) -> &'xa i32> = None;
66 //~^ ERROR lifetime bounds cannot be used in this context
67 let _ : Option<Box<dyn for<'xa, 'xb: 'xa> Fn(&'xa i32, &'xb i32) -> &'xa i32>> = None;
68 //~^ ERROR lifetime bounds cannot be used in this context