Repository navigation
Description
The feature gate for the issue is #![feature(diagnotic_on_type_err)].
Description of the feature
Similar to other diagnostic attribute, the goal of diagnostic::on_type_error is to allow crate authors to attach custom notes to type errors involving their types, improving diagnostics for common patterns such as wrapper types where users forget to access the inner value or different inner type or outer value.
As agreed upon, see #155200 (comment), the semantic will only be:
- only note is supported (not message or label)
- the annotated ADT must have exactly one generic type parameter
- More advanced features such as filtering based on types or generics will supported in the future
Minimally for now, we will be supporting:
#[diagnostic::on_type_error(
note = "text",
)]
struct S<T>(T);
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.
Steps
- Implement the RFC (cc @rust-lang/XXX -- can anyone write up mentoring
instructions?) - Adjust documentation ([see instructions on rustc-dev-guide][doc-guide])
- Style updates for any new syntax ([nightly-style-procedure])
- Style team decision on new formatting
- Formatting for new syntax has been added to the [Style Guide]
- (non-blocking) Formatting has been implemented in
rustfmt
- Stabilization PR ([see instructions on rustc-dev-guide][stabilization-guide])
Activity
Unique-Usman commentedon Apr 16, 2026
@rustbot label +T-lang
Unique-Usman commentedon Apr 16, 2026
cc: @rperier and @estebank