Skip to content

Reword ?Trait bound diagnostic #136944

Open
Open
@compiler-errors

Description

@compiler-errors

I don't want to block this PR on surface level things like phrasing, so feel free to ignore this and I'll submit this as a follow-up PR. I've never liked how this specific diagnostic is formulated, it's super verbose.

Now with this being a hard error this sentence doesn't quite make sense anymore. I'd rather see a message that's straight to the point like `?` can only be applied to `Sized` (similar to `~const` can only be applied to `#[const_trait]` traits or `async` bound modifier only allowed on `Fn`/`FnMut`/`FnOnce` traits) and defer any further explanations to diagnostic note/help messages if at all (cc error codes).

If we wanted to feel fancy we could provide a structured suggestion for removing the entire bound.

Originally posted by @fmease in #135841 (comment)

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions