-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interaction between elision and trait objects is not ideal #1302
Comments
Here are some notes from our discussion in the language subteam meeting. There are basically four options:
Here are some examples, and how they behave under each of those. Let's take these traits: trait Trait { }
trait TraitStatic:'static {}
trait TraitA<'a>: 'a { } And then let's look at various examples and see how the rules play out:
Today these are equivalent to Interestingly, the first case becomes an error (and hence a regression!) under rules 2, 3, and 5 above. This is because those rules would cause us to ignore the
This case works the same under all proposals. It expands to
Similarly to the previous one, this case works the same under all proposals. It expands to:
the reasons are basically the same.
This is an error today because the input has two lifetimes,
This is an error today because you get two distinct lifetimes, the
Today this is an error. I would like it to continue being an error. The only rule where it is NOT an error is rule 5.
Today this is an error. I would like it to continue being an error, but it will not be an error under rules 4 or 5. |
cc @rust-lang/lang |
As observed on rust-lang/rust#27248, the interaction between elision and trait objects changed recently as the result of a bug fix, but in some cases the older, buggy behavior may have been preferable. In particular, trait object defaults operate by different rules per RFC 599. I have also argued that object lifetime defaults ought to be treated differently from other lifetimes for the purpose of
'_
, which is closely tied to elision. However, it's unclear just what the new rules ought to be.The text was updated successfully, but these errors were encountered: