Skip to content
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

Lifetime elision in trait constraints #1352

Open
steveklabnik opened this issue Nov 5, 2015 · 0 comments
Open

Lifetime elision in trait constraints #1352

steveklabnik opened this issue Nov 5, 2015 · 0 comments
Labels
T-lang Relevant to the language team, which will review and decide on the RFC.

Comments

@steveklabnik
Copy link
Member

Originally from rust-lang/rust#13840:

This compiles:

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

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

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-lang Relevant to the language team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

3 participants