Skip to content

Unnamed argument in type alias parsed incorrectly #3089

@hanmertens

Description

@hanmertens

The following type alias with an unnamed argument (_)

pub type test = unsafe extern "C" fn(_: *const gchar) -> ();

gives some errors when parsed by rust-analyzer (commit 29f5e7e):

 test.rs     1  39 error           rust-analyzer: Syntax Error: expected type (lsp-ui)
 test.rs     1  39 error           rust-analyzer: Syntax Error: expected COMMA (lsp-ui)
 test.rs     1  40 error           rust-analyzer: Syntax Error: expected COMMA (lsp-ui)

When the variable is named or the unnamed variable is in a function declaration no syntax errors are generated:

pub type test = unsafe extern "C" fn(test: *const gchar) -> ();
unsafe extern "C" fn test(_: *const gchar) -> ();

Metadata

Metadata

Assignees

No one assigned

    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