- Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsF-on_unimplementedError messages that can be tackled with `#[rustc_on_unimplemented]`Error messages that can be tackled with `#[rustc_on_unimplemented]`P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics
Description
The following code
struct SetFoo; struct SetBar; struct S<Foo, Bar>(Foo, Bar); impl S<SetFoo, ()> { #[diagnostic::on_unimplemented(message= "builder with missing mandatory fields", label="you must set every mandatory field")] fn build() {} } fn main() { S::<(), SetBar>::build(); }should let you customize the output of E0599. Currently, it is
error[E0599]: no function or associated item named `build` found for struct `S<(), SetBar>` in the current scope --> src/main.rs:11:22 | 4 | struct S<Foo, Bar>(Foo, Bar); | ------------------ function or associated item `build` not found for this struct ... 11 | S::<(), SetBar>::build(); | ^^^^^ function or associated item not found in `S<(), SetBar>` | = note: the function or associated item was found for - `S<SetFoo, ()>` but it should allow you to output
error[E0599]: builder with missing mandatory fields --> src/main.rs:11:22 | 4 | struct S<Foo, Bar>(Foo, Bar); | ------------------ function or associated item `build` not found for this struct ... 11 | S::<(), SetBar>::build(); | ^^^^^ you must set every mandatory field | = note: function or associated item not found in `S<(), SetBar>` = note: the function or associated item was found for - `S<SetFoo, ()>` Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsF-on_unimplementedError messages that can be tackled with `#[rustc_on_unimplemented]`Error messages that can be tackled with `#[rustc_on_unimplemented]`P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics