jpernst / rental

Rust macro to generate self-referential structs
Apache License 2.0
211 stars 11 forks source link

Traits fail with "cannot infer an appropriate lifetime" #18

Closed beamspease closed 7 years ago

beamspease commented 7 years ago

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

jpernst commented 7 years ago

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.

beamspease commented 7 years ago

That's awesome, thanks! :)

On Tuesday, June 6, 2017, jpernst notifications@github.com wrote:

I've isolated the cause and published a fix. 0.4.11 should support trait objects now. Thanks for the report.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jpernst/rental/issues/18#issuecomment-306631360, or mute the thread https://github.com/notifications/unsubscribe-auth/AMDN227jjI9vE2OKDILGDr5xZ-M9X81Mks5sBc1sgaJpZM4NxPIF .

--