Skip to content

E0623 gives wrong error message for following example with fn items #43937

@gaurikholkar-zz

Description

@gaurikholkar-zz
fn foo(x: fn(&u8, &u8), y: Vec<&u8>, z: &u8) { y.push(z); } fn main(){} 

gives

2 | fn foo(x: fn(&u8, &u8), y: Vec<&u8>, z: &u8) { | --- --- these references are not declared with the same lifetime... 3 | y.push(z); | ^ ...but data from `z` flows into `y` here 

but should be giving

2 | fn foo(x: fn(&u8, &u8), y: Vec<&u8>, z: &u8) { | --- --- these references are not declared with the same lifetime... 3 | y.push(z); // index will be zero or one | ^ ...but data from `z` flows into `y` here 

cc @nikomatsakis

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions