]> git.proxmox.com Git - rustc.git/blob - tests/ui/error-codes/E0657.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / error-codes / E0657.rs
1 #![allow(warnings)]
2
3 trait Id<T> {}
4 trait Lt<'a> {}
5
6 impl<'a> Lt<'a> for () {}
7 impl<T> Id<T> for T {}
8
9 fn free_fn_capture_hrtb_in_impl_trait()
10 -> Box<for<'a> Id<impl Lt<'a>>>
11 //~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level [E0657]
12 {
13 Box::new(())
14 }
15
16 struct Foo;
17 impl Foo {
18 fn impl_fn_capture_hrtb_in_impl_trait()
19 -> Box<for<'a> Id<impl Lt<'a>>>
20 //~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level
21 {
22 Box::new(())
23 }
24 }
25
26 fn main() {}