Trait method parameters now need to have names in 2018 edition

The following compiles in the 2015 edition but not on the 2018 edition:

pub trait A {
    fn go(&self, u32);

If a name is added like so then it works on both editions:

pub trait A {
    fn go(&self, a: u32);

Playground link

Was this change intentional? I tried to find documentation or discussion of it, but was unable to.

Basically, this makes the rustdocs better, and makes it feasible to allow some things like slice patterns in method implementations in traits.


There’s an issue for this confusion from this change: #53990

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.