impl Trait
with multiple lifetimes imposes a strange lifetime requirement
#61756
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
A-lifetimes
Area: Lifetimes / regions
A-NLL
Area: Non-lexical lifetimes (NLL)
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Consider the following code:
Compiling with
#![feature(nll)]
yields the following error:That is, it's requiring that the reference to
Transaction
outlive'a
. Unfortunately, it doesn't explain at all why that requirement was imposed.Also, just returning
+ '_
complains:This is odd to me because if we return
Box<dyn Iterator<Item = u64> + '_>
, everything works fine (and nobody complains about'a
). Furthermore, the equivalent to theimpl Trait
using an explicitexistential type TransactionScan<'a, 'b>: Iterator<Item = u64>;
works fine as well.This may be related to/a dupe of #49431, but the errors produced are different so I'm not sure.
The text was updated successfully, but these errors were encountered: