Skip to content

rustfmt can't parse negative const generic parameters #3614

@bgourlie

Description

@bgourlie

cargo +nightly fmt fails to parse the following code:

#![feature(const_generics)] fn main() { let i = test::<-1>(); println!("Hello, {}!", i); } fn test<const T: i8>() -> i8 { {T} } 

output:

error: expected identifier, found `<-` --> /Users/brian/Repos/untitled3/src/main.rs:4:19 | 4 | let i = test::<-1>(); | ^^ expected identifier 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions