]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/hrtb/hrtb-just-for-static.rs
1 // Test a case where you have an impl of `Foo<X>` for all `X` that
2 // is being applied to `for<'a> Foo<&'a mut X>`. Issue #19730.
5 fn foo(&self, x
: X
) { }
9 where T
: for<'a
> Foo
<&'a
isize>
13 // AnyInt implements Foo<&'a isize> for any 'a, so it is a match.
15 impl<'a
> Foo
<&'a
isize> for AnyInt { }
20 // StaticInt only implements Foo<&'static isize>, so it is an error.
22 impl Foo
<&'
static isize> for StaticInt { }
24 want_hrtb
::<StaticInt
>() //~ ERROR
27 // &'a u32 only implements Foo<&'a isize> for specific 'a, so it is an error.
28 impl<'a
> Foo
<&'a
isize> for &'a
u32 { }
30 want_hrtb
::<&'a
u32>()
31 //~^ ERROR lifetime may not live long enough
32 //~| ERROR implementation of `Foo` is not general enough