Merged
Conversation
Contributor
|
Some changes occurred in src/tools/clippy. cc @rust-lang/clippy |
This comment was marked as resolved.
This comment was marked as resolved.
26e0289 to
4874fa3
Compare
Contributor
|
One thing I noticed is that you might not be supporting |
This comment was marked as resolved.
This comment was marked as resolved.
Change `span_suggestion` (and variants) to take `impl ToString` rather than `String` for the suggested code, as this simplifies the requirements on the diagnostic derive. Signed-off-by: David Wood <david.wood@huawei.com>
Move existing test for session diagnostic derive to a subdirectory. Signed-off-by: David Wood <david.wood@huawei.com>
Add a new derive, `#[derive(SessionSubdiagnostic)]`, which enables deriving structs for labels, notes, helps and suggestions. Signed-off-by: David Wood <david.wood@huawei.com>
Split `SessionDiagnostic` and `SessionSubdiagnostic` derives and the various helper functions into multiple modules. Signed-off-by: David Wood <david.wood@huawei.com>
Remove some duplicated code between both diagnostic derives by introducing helper functions for reporting an error in case of a invalid attribute. Signed-off-by: David Wood <david.wood@huawei.com>
`SetOnce` trait was introduced in the subdiagnostic derive to simplify the code a little bit, re-use it in the diagnostic derive too. Signed-off-by: David Wood <david.wood@huawei.com>
Documentation comments are always good. Signed-off-by: David Wood <david.wood@huawei.com>
In the initial implementation of the `SessionSubdiagnostic`, the `Applicability` of a suggestion can be set both as a field and as part of the attribute, this commit adds the same support to the original `SessionDiagnostic` derive. Signed-off-by: David Wood <david.wood@huawei.com>
Add `#[subdiagnostic]` field attribute to the diagnostic derive which is applied to fields that have types which use the subdiagnostic derive. Signed-off-by: David Wood <david.wood@huawei.com>
4874fa3 to
dca8861
Compare
Contributor
|
@bors r+ |
Collaborator
|
📌 Commit dca8861 has been approved by |
Collaborator
Collaborator
|
☀️ Test successful - checks-actions |
Collaborator
|
Finished benchmarking commit (683c582): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a new macro,
#[derive(SessionSubdiagnostic)], which can be applied to structs that represent subdiagnostics, such as labels, notes, helps or suggestions.#[derive(SessionSubdiagnostic)]can be used with the existing#[derive(SessionDiagnostic)]. All diagnostics implemented using either derive are translatable, and this new derive should make it easier to port existing diagnostics to using these derives.For example, consider the following subdiagnostic types...
...and the corresponding Fluent messages:
These can be emitted using the new
subdiagnosticfunction onDiagnostic......or as part of a larger
#[derive(SessionDiagnostic)]:r? @oli-obk
cc @pvdrz