Skip to content

Conversation

@Darksonn
Copy link

@Darksonn Darksonn commented Dec 2, 2025

When a struct uses dyn MyTrait as its last field, there is an implicit 'static bound on the trait object. This means that converting any T: MyTrait into such a trait object is not ok. Thus, add a + 'static bound to the bounds on the generated methods to check for this unless the trait object contains an explicit lifetime.

This was discovered during a crater run of rust-lang/rust#136776.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant