Skip to content

Can't compile type with lifetime bound in certain order #39085

Closed
@frewsxcv

Description

@frewsxcv

This compiles:

fn lol<'a>() -> Box<Iterator<Item=()> + 'a> {
    unimplemented!()
}

fn main() {
}

This doesn't:

fn lol<'a>() -> Box<Iterator<'a + Item=()>> {
    unimplemented!()
}

fn main() {
}

Error:

rustc 1.16.0-nightly (1a2ed98d3 2017-01-13)
error: expected `,` or `>` after lifetime name, found `+`
 --> <anon>:1:24
  |
1 | fn lol<'a>() -> Box<'a + Iterator<Item=()>> {
  |                        ^
  |
note: did you mean a single argument type &'a Type, or did you mean the comma-separated arguments 'a, Type?
 --> <anon>:1:21
  |
1 | fn lol<'a>() -> Box<'a + Iterator<Item=()>> {
  |                     ^^^^

error: aborting due to previous error

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions