You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/attributes/diagnostics.md
+15-9
Original file line number
Diff line number
Diff line change
@@ -303,19 +303,29 @@ When used on a function in a trait implementation, the attribute does nothing.
303
303
304
304
## The `diagnostic` toolattributenamespace
305
305
306
-
The `#[diagnostic]` attributenamespaceismeanttoprovideahomeforattributethatallowuserstoinfluenceerrormessagesemittedbythecompiler.Thecompilerisnotguaranteedtouse any of this hints, however it should accept any (non-)existing attribute in this namespace and potentially emit lint-warnings for unused attributes and options.This is meant to allow discarding certain attributes/options in the future to allow fundamental changes to the compiler without the need to keep then non-meaningful options working.
306
+
The `#[diagnostic]` attributenamespaceismeanttoprovideahomeforattributestoinfluencecompile-timeerrormessages.
The `#[diagnostic::on_unimplemented]` attribute is allowed to appear on trait definitions.This allows crate authors to hint the compiler to emit a specific worded error message if a certain trait is not implemented.The hinted message is supposed to replace the otherwise emitted error message.For the `#[diagnostic::on_unimplemented]` attribute the following options are implemented:
314
+
The `#[diagnostic::on_unimplemented]` attributeisdesignedtoappearontraitdefinitions.
The `note` option can appear several times, which results in several note messages being emitted.If any of the other options appears several times the first occurrence of the relevant option specifies the actually used value.Any other occurrence generates an lint warning.For any other non-existing option a lint-warning is generated.
322
+
The `note` optioncanappearseveraltimes, whichresultsinseveralnotemessagesbeingemitted.
All three options accept a text as argument.This text is allowed to contain format parameters referring to generic argument or `Self` by name via the `{Self}` or `{NameOfGenericArgument}` syntax.Any other format parameter will generate a warning, but will otherwise be included in the string as-is.
326
+
Allthreeoptionsacceptatextasargument.
327
+
Thistextisallowedtocontainformatparametersreferringtogenericargumentor `Self` bynameviathe `{Self}` or `{NameOfGenericArgument}` syntax, where `{Self}` isresolvedtothenameofthetypeimplementingthetraitand `{NameOfGenericArgument}` isresolvedtotherelevanttypenamethatreplacesthe `{NameOfGenericArgument}` argumentiftheerrormessageisemitted.
0 commit comments