Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Require 'static on trait objects#1

Merged
jsen- merged 1 commit into
jsen-:masterfrom
Darksonn:alice/static
Mar 30, 2026
Merged

Require 'static on trait objects#1
jsen- merged 1 commit into
jsen-:masterfrom
Darksonn:alice/static

Conversation

@Darksonn

@Darksonn Darksonn commented Dec 2, 2025

Copy link
Copy Markdown
Contributor

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.

@jsen-

jsen- commented Mar 30, 2026

Copy link
Copy Markdown
Owner

Hi Alice, sorry for late reply, I somehow managed to "unwatch" this repo.
Just found out about this after cargo bisect-rustc pointed me to the original rust PR by Boxy.

Thank you for the update and everything you do for the rust community.

@jsen- jsen- merged commit 57daf51 into jsen-:master Mar 30, 2026
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.

2 participants