jpernst/rental

Traits fail with "cannot infer an appropriate lifetime"

beamspease opened this issue · 2 comments

Rough situation:

rental! {
    mod rent_MyStruct {
        use library;
        
        #[rental]
        pub struct MyStruct {
            my_trait: Box<Trait>,
            my_suffix: Suffix<'my_trait>,
        }
    }
}

Unfortunately, I can't post the exact errors at the moment

I've isolated the cause and published a fix. 0.4.11 should support trait objects now. Thanks for the report. Note that you might need to add a 'static bound to the trait object, since rust otherwise tries to guess the bound and it may guess wrong. Reopen this is it's still broken in the new version.