Skip to content

Lifetime parameters are silently deleted #42115

Closed
@djzin

Description

@djzin

This compiles:

fn lifetime<'a>()
    where &'a (): 'a
{
    /* do nothing */
}

fn main() {
    lifetime::<'static>()
}

as does this:

fn lifetime<'a>() {} 
fn main() {
    lifetime();
}

but this fails:

fn lifetime<'a>() {}
fn main() {
    lifetime::<'static>();
}
rustc 1.19.0-nightly (5dfcd85fd 2017-05-19)
error[E0088]: too many lifetime parameters provided: expected at most 0 lifetime parameters, found 1 lifetime parameter
 --> <anon>:3:5
  |
3 |     lifetime::<'static>();
  |     ^^^^^^^^^^^^^^^^^^^ expected 0 lifetime parameters

error: aborting due to previous error

Metadata

Metadata

Assignees

Labels

P-highHigh priorityT-compilerRelevant to the compiler 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