Skip to content

Incoming breakage: Explicitly specify the lifetime bound of a trait object type that's passed to a type-relative path in an item signature#1

Open
fmease wants to merge 1 commit into
asafigan:mainfrom
fmease-extra:specify-dyn-region
Open

Incoming breakage: Explicitly specify the lifetime bound of a trait object type that's passed to a type-relative path in an item signature#1
fmease wants to merge 1 commit into
asafigan:mainfrom
fmease-extra:specify-dyn-region

Conversation

@fmease

@fmease fmease commented Jul 19, 2026

Copy link
Copy Markdown

Hello there 👋, I'm a member of the Rust compiler team.

In Rust 1.98 (current beta, to be released on 2026-08-20) the rules around trait object lifetime defaulting have changed slightly. See rust-lang/rust#129543 for details. cargo +beta test in your project fails with cannot deduce the lifetime bound for this trait object type from context (see also).

It's now necessary to manually specify this lifetime bound for the time being. In the future, rustc might infer lifetime bounds again in this context. However, it would then actually infer 'a instead of 'static. The fact that it's deduced to be 'static prior to 1.98 is incorrect.

I've specified it to be 'static since setting the bound to be 'a would actually lead to further lifetime errors in this specific case.


This ecosystem regression was found thanks to crater. See also rust-lang/rust#159430.

Thanks a lot in advance for your understanding and apologies for the inconvenience.
Feel free to ask me questions if you have any.

…assed to a type-relative path in an item signature

In Rust 1.98 the rules around trait object lifetime defaulting have changed slightly.

It's now necessary to manually specify this lifetime bound for the time being.
In the future, rustc might infer lifetime bounds again in this context.
However, it would then actually infer `'a` instead of `'static`.
The fact that it's deduced to be `'static` prior to 1.98 is incorrect.

I've specified it to be `'static` since setting the bound to be `'a` would actually
lead to further lifetime errors in this specific case.
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