As @quinedot already mentioned it’s not exactly “the same”, but both can be used to achieve the same goal, that is, removing the need to give a lower-bound constrain on the return type’s lifetime. You can e.g. use either impl MentionsLifetime<'a1> + MentionsLifetime<'a2> + …
or impl 'b + …, where 'a1: 'b, 'a2: 'b
in order to use two unrelated lifetimes in the return type. (Whereas impl 'a1 + 'a2 + …
doesn’t work.)
Note that if the remaining trait bounds also contain lifetimes or generic type parameters, e.g. SomeTrait<'foo, T>
, then you might need additional bounds e.g. impl 'b + SomeTrait<'foo, T>, where 'a1: 'b, 'a2: 'b, 'foo: 'b, Bar: 'b
, whereas impl MentionsLifetime<'a1> + MentionsLifetime<'a2> + SomeTrait<'foo, T>
works without extra where
clauses. Actually, for generic type parameters, you’ll probably need to bound all of them, even when they’re not explicitly mentioned.