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

Mixed signals from errors about trait const fns #64947

Open
glandium opened this issue Oct 1, 2019 · 2 comments

Comments

@glandium
Copy link
Contributor

commented Oct 1, 2019

I was trying to define a trait method as const, but it turned out in an error, which, according to RFC911 is a design decision, and the tracking issue for const fn doesn't seem to indicate any change in that matter.

However, the errors I got from the compiler give mixed signals:

error[E0379]: trait fns cannot be declared const
 --> src/num.rs:6:5
  |
6 |     const fn next_multiple_of(self, m: T) -> Self;
  |     ^^^^^ trait fns cannot be const

error[E0658]: const fn is unstable
 --> src/num.rs:6:5
  |
6 |     const fn next_multiple_of(self, m: T) -> Self;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: for more information, see https://github.com/rust-lang/rust/issues/57563

This could be interpreted as "trait fns cannot be declared const... yet", while the current status is more like "trait fns cannot be declared const now or in the foreseeable future".

@Centril

This comment has been minimized.

Copy link
Member

commented Oct 2, 2019

I think the most honest thing to do here would be to point at the RFC. cc @oli-obk

@glandium

This comment has been minimized.

Copy link
Contributor Author

commented Oct 2, 2019

I think pointing at the RFC in E0379 and not emitting E0658 would be better.

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