Error message E0568 doesn't match actual restrictions on auto traits
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the E0568 error-code documentation and the auto-trait diagnostic reproduced in the issue. Confirm which bounds auto traits actually reject, then align the diagnostic wording with that rule and verify the shown example's output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100