]>
git.proxmox.com Git - rustc.git/blob - tests/ui/regions/regions-outlives-projection-container-wc.rs
1 // Test that we are imposing the requirement that every associated
2 // type of a bound that appears in the where clause on a struct must
3 // outlive the location in which the type appears, even when the
4 // constraint is in a where clause not a bound. Issue #22246.
12 pub struct TheType
<'b
> {
16 impl<'b
> TheTrait
for TheType
<'b
> {
17 type TheAssocType
= &'
b ();
20 pub struct WithAssoc
<T
> where T
: TheTrait
{
24 fn with_assoc
<'a
,'b
>() {
25 // For this type to be valid, the rules require that all
26 // associated types of traits that appear in `WithAssoc` must
27 // outlive 'a. In this case, that means TheType<'b>::TheAssocType,
28 // which is &'b (), must outlive 'a.
30 let _
: &'a WithAssoc
<TheType
<'b
>> = loop { }
;
31 //~^ ERROR lifetime may not live long enough