Skip to content

feature(const_trait_impl) is treated as syntax error #7313

@andre-richter

Description

@andre-richter

Hi,

experimental feature const_trait_impl is treated as a syntax error by rust-analyzer. For example, on nightly, the following compiles, but rust-analyzer would complain about the impl const and even erase the const on saving.

#![allow(incomplete_features)]
#![feature(const_trait_impl)]

struct X(u32);

impl const core::ops::Add<u32> for X {
    type Output = u32;
    
    fn add(self, other: u32) -> u32 {
        self.0 + other
    }
}

fn main(){
    let y = X(2);

    println!("{}", y + 1u32);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserparser issuesS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions