Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2018 edition - confusing error message when declaring unnamed parameters #53990

Closed
EpicatSupercell opened this Issue Sep 6, 2018 · 2 comments

Comments

Projects
None yet
4 participants
@EpicatSupercell
Copy link

EpicatSupercell commented Sep 6, 2018

This code works correctly on nightly and stable

trait Trait {
    fn func(u8);
}

but not on 2018 edition, where it returns the error

error: expected one of `:` or `@`, found `)`
 --> src/main.rs:2:15
  |
2 |     fn func(u8);
  |               ^ expected one of `:` or `@` here

Changing it to func(_: u8) solves it.

Is this an intended change?
I couldn't find anything about it in the edition guide.

@EpicatSupercell EpicatSupercell changed the title 2018 edition regression - associated types access with Self 2018 edition regression - function parameters in traits inconsistency Sep 6, 2018

@EpicatSupercell EpicatSupercell changed the title 2018 edition regression - function parameters in traits inconsistency 2018 edition inconsistency - parameters of functions in traits Sep 6, 2018

@jonas-schievink

This comment has been minimized.

Copy link
Member

jonas-schievink commented Sep 6, 2018

Yes, this was done in #53612

@EpicatSupercell

This comment has been minimized.

Copy link
Author

EpicatSupercell commented Sep 6, 2018

So apparently it was part of RFC 1685. In that case we should at least fix the error message, since it doesn't explain the source of the error at all.

@EpicatSupercell EpicatSupercell changed the title 2018 edition inconsistency - parameters of functions in traits 2018 edition - confusing error message when declaring unnamed parameters Sep 6, 2018

@davidtwco davidtwco self-assigned this Dec 7, 2018

bors added a commit that referenced this issue Dec 11, 2018

Auto merge of #56584 - davidtwco:issue-53990, r=nikomatsakis
2018 edition - confusing error message when declaring unnamed parameters

Fixes #53990.

This PR adds a note providing context for the change to argument
names being required in the 2018 edition for trait methods and a
suggestion for the fix.

bors added a commit that referenced this issue Dec 15, 2018

Auto merge of #56584 - davidtwco:issue-53990, r=nikomatsakis
2018 edition - confusing error message when declaring unnamed parameters

Fixes #53990.

This PR adds a note providing context for the change to argument
names being required in the 2018 edition for trait methods and a
suggestion for the fix.

@bors bors closed this in #56584 Dec 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.