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

Error message E0568 doesn't match actual restrictions on auto traits #117838

Open
jruderman opened this issue Nov 12, 2023 · 1 comment
Open

Error message E0568 doesn't match actual restrictions on auto traits #117838

jruderman opened this issue Nov 12, 2023 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints F-auto_traits `#![feature(auto_traits)]`

Comments

@jruderman
Copy link
Contributor

jruderman commented Nov 12, 2023

I noticed this while looking at #117829.

Code

#![feature(auto_traits)]

struct A {}

auto trait B where
    A: B,
{
}

fn main() {}

Error output

error[E0568]: auto traits cannot have super traits or lifetime bounds
 --> np.rs:5:14
  |
5 |   auto trait B where
  |  ____________-_^
  | |            |
  | |            auto traits cannot have super traits or lifetime bounds
6 | |     A: B,
  | |_________^ help: remove the super traits or lifetime bounds

error: aborting due to previous error

For more information about this error, try `rustc --explain E0568`.

The problem

The error message E0568 refers to "super traits or lifetime bounds", but this code isn't trying to use either of those features.

I guess the error message should be updated to reflect the actual rule, or split into two error messages. But I'm not sure what the actual rule is for auto traits. No bounds at all, whether directly on the trait or in where clauses?

CC @FabianWolff who updated the rule and error message in #89494

Version

rustc 1.75.0-nightly (fdaaaf9f9 2023-11-08)
binary: rustc
commit-hash: fdaaaf9f923281ab98b865259aa40fbf93d72c7a
commit-date: 2023-11-08
host: x86_64-apple-darwin
release: 1.75.0-nightly
LLVM version: 17.0.4

@rustbot label +A-diagnostics +f-auto_traits

@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. A-diagnostics Area: Messages for errors, warnings, and lints F-auto_traits `#![feature(auto_traits)]` labels Nov 12, 2023
@compiler-errors
Copy link
Member

Yeah it should just say "supertraits or where clauses"

@Noratrieb Noratrieb removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints F-auto_traits `#![feature(auto_traits)]`
Projects
None yet
Development

No branches or pull requests

4 participants