Skip to content

Trait constraints should allow anonymous lifetimes for references. #13840

Closed
@ciphergoth

Description

@ciphergoth

This compiles:

fn isum<'a, I: Iterator<&'a int>>(mut it: I) -> int { it.fold(0, |a, b| a + *b) }

This should be the same, but doesn't compile:

fn isum<I: Iterator<&int>>(mut it: I) -> int { it.fold(0, |a, b| a + *b)}

The compiler complains of a "missing lifetime specifier" at the &int.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesArea: Lifetimes / regionsT-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions