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
Conversation
fmease
force-pushed
the
specify-dyn-region
branch
from
July 19, 2026 14:43
decc781 to
18fb961
Compare
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 testin your project fails withcannot 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
'ainstead of'static. The fact that it's deduced to be'staticprior to 1.98 is incorrect.I've specified it to be
'staticsince setting the bound to be'awould 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.