Tracking Issue for #[diagnostic::on_type_error]
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
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 https://github.com/rust-lang/rust/pull/155200#issuecomment-4256434080, 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])
Implementation history
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 by reading PR #155200 and the feature description to understand the current implementation of diagnostic::on_type_error. Use the tracking checklist and the rustc-dev-guide, documentation, and Style Guide links to identify remaining work. Done means the implementation, documentation, syntax style decision and formatting, and stabilization steps are complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100