Precice capturing does not normalize aliases/projections (e.g. Self::Assoc) #140274
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
I expected to see this happen (in increasing order of preference):
Self
specifically as the origin of lifetime capturing (not the entire opaque)Further explanation: It's natural to copy the bounds from the trait definition. Moreover one may, say, add precise captures during the course of development by editing an opaque that is already present (which may use aliases such as
Self
). It's easy to miss that any use ofSelf
can pull in other parameters. In the example it pulls in not only the lifetime in the implementing type, but also the one in the trait:It would be a breaking change to make
Self::Item
capture the lifetimes, so normalizing shouldn't be a future compatibility concern for the example at least.If normalization/successful compilation isn't possible for whatever reason, this can be considered purely a diagnostic issue.
Instead, this happened:
Meta
Playground beta and nightly
The text was updated successfully, but these errors were encountered: