about summary refs log tree commit diff
path: root/src/test/ui-fulldeps/session-diagnostic
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-2886/+0
2022-12-14Auto merge of #105233 - mejrs:always_eager, r=estebankbors-18/+34
Always evaluate vecs of subdiagnostics eagerly See https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20lists!/near/310186705 for context
2022-12-13bless fulldeps testsOli Scherer-3/+1
2022-12-13Make some diagnostics not depend on the source of what they reference being ↵Oli Scherer-2/+1
available
2022-12-04Always evaluate vecs of subdiagnostics eagerlymejrs-18/+34
2022-11-21Improve slug name errormejrs-0/+35
2022-11-21Fix testsmejrs-129/+129
2022-10-26Remove #[suggestion_*] attributesXiretza-72/+84
2022-10-26Add "tool-only" suggestion styleXiretza-9/+16
2022-10-26rustfmt diagnostic derive testsXiretza-85/+80
2022-10-26Add style= parameter to suggestion attributesXiretza-4/+141
2022-10-23Allow specifying multiple alternative suggestionsXiretza-2/+133
This allows porting uses of span_suggestions() to diagnostic structs. Doesn't work for multipart_suggestions() because the rank would be reversed - the struct would specify multiple spans, each of which has multiple possible replacements, while multipart_suggestions() creates multiple possible replacements, each with multiple spans.
2022-10-23Update translation testsNilstrieb-326/+326
2022-10-17macros: allow subdiagnostic-kind-less variantsDavid Wood-50/+43
Sometimes it is convenient to return a subdiagnostic enum where one or more of the variants don't add anything to the diagnostic. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-17macros: support doc comments in diag derivesDavid Wood-0/+30
Documentation comments shouldn't affect the diagnostic derive in any way, but explicit support has to be added for ignoring the `doc` attribute. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10macros: separate suggestion fmt'ing and emissionDavid Wood-0/+24
Diagnostic derives have previously had to take special care when ordering the generated code so that fields were not used after a move. This is unlikely for most fields because a field is either annotated with a subdiagnostic attribute and is thus likely a `Span` and copiable, or is a argument, in which case it is only used once by `set_arg` anyway. However, format strings for code in suggestions can result in fields being used after being moved if not ordered carefully. As a result, the derive currently puts `set_arg` calls last (just before emission), such as: ```rust let diag = { /* create diagnostic */ }; diag.span_suggestion_with_style( span, fluent::crate::slug, format!("{}", __binding_0), Applicability::Unknown, SuggestionStyle::ShowAlways ); /* + other subdiagnostic additions */ diag.set_arg("foo", __binding_0); /* + other `set_arg` calls */ diag.emit(); ``` For eager translation, this doesn't work, as the message being translated eagerly can assume that all arguments are available - so arguments _must_ be set first. Format strings for suggestion code are now separated into two parts - an initialization line that performs the formatting into a variable, and a usage in the subdiagnostic addition. By separating these parts, the initialization can happen before arguments are set, preserving the desired order so that code compiles, while still enabling arguments to be set before subdiagnostics are added. ```rust let diag = { /* create diagnostic */ }; let __code_0 = format!("{}", __binding_0); /* + other formatting */ diag.set_arg("foo", __binding_0); /* + other `set_arg` calls */ diag.span_suggestion_with_style( span, fluent::crate::slug, __code_0, Applicability::Unknown, SuggestionStyle::ShowAlways ); /* + other subdiagnostic additions */ diag.emit(); ``` Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10macros: `#[subdiagnostic(eager)]`David Wood-1/+88
Add support for `eager` argument to the `subdiagnostic` attribute which generates a call to `eager_subdiagnostic`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-03errors: rename `typeck.ftl` to `hir_analysis.ftl`David Wood-227/+227
In #102306, `rustc_typeck` was renamed to `rustc_hir_analysis` but the diagnostic resources were not renamed - which is what this commit changes. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-01`ui-fulldeps`: adopt to the new rustc lint APIMaybe Waffle-14/+22
2022-09-28Auto merge of #101619 - Xiretza:rustc_parse-session-diagnostics, r=davidtwcobors-0/+14
Migrate more of rustc_parse to SessionDiagnostic Still far from complete, but I thought I'd add a checkpoint here because rebasing was starting to get annoying.
2022-09-27Allow raw identifiers to be used as fluent argumentsXiretza-0/+14
2022-09-27Update tests.Mara Bos-6/+4
2022-09-26macros: support diagnostic derive on enumsDavid Wood-88/+119
Signed-off-by: David Wood <david.wood@huawei.com>
2022-09-22Unify subdiagnostic attribute parsingXiretza-85/+221
2022-09-22Add missing code="" attributes to suggestion subdiagnosticsXiretza-1/+1
2022-09-22Extract subdiagnostic attribute parsingXiretza-83/+105
2022-09-22Point to previous applicability when declared multiple timesXiretza-2/+8
2022-09-22Ensure #[suggestion] is only applied to correct tuple typesXiretza-15/+55
2022-09-22Ensure code= in #[suggestion(...)] is only set onceXiretza-1/+21
2022-09-21FIX - adopt new Diagnostic naming in newly migrated modulesJhonny Bill Mena-1/+1
FIX - ambiguous Diagnostic link in docs UPDATE - rename diagnostic_items to IntoDiagnostic and AddToDiagnostic [Gardening] FIX - formatting via `x fmt` FIX - rebase conflicts. NOTE: Confirm wheather or not we want to handle TargetDataLayoutErrorsWrapper this way DELETE - unneeded allow attributes in Handler method FIX - broken test FIX - Rebase conflict UPDATE - rename residual _SessionDiagnostic and fix LintDiag link
2022-09-21UPDATE - rename SessionSubdiagnostic macro to SubdiagnosticJhonny Bill Mena-67/+67
Also renames: - sym::AddSubdiagnostic to sym:: Subdiagnostic - rustc_diagnostic_item = "AddSubdiagnostic" to rustc_diagnostic_item = "Subdiagnostic"
2022-09-21UPDATE - rename DiagnosticHandler macro to DiagnosticJhonny Bill Mena-85/+85
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-85/+85
2022-09-02Rollup merge of #101294 - Xiretza:fix-100844-accident, r=davidtwcoGuillaume Gomez-85/+299
Fix #100844 rebase accident This undoes the rebase accident in #100844, which accidentally caused #100970 to be reverted.
2022-09-01Allow deriving multiple subdiagnostics using one SessionSubdiagnosticXiretza-48/+34
This reimplements ac638c1, which had to be reverted in the previous commit because it contains a rebase accident that itself reverted significant unrelated changes to SessionSubdiagnostic.
2022-09-01Revert parts of "use derive proc macro to impl SessionDiagnostic"Xiretza-85/+313
This reverts parts of commit ac638c1f5fca36484506415319ab254ad522a692. During rebase, this commit accidentally reverted unrelated changes to the subdiagnostic derive (those allowing multipart_suggestions to be derived). This commit reverts all changes to the subdiagnostic code made in ac638c1f5fc, the next commit will reintroduce the actually intended changes.
2022-09-01Adjust stderr fileOli Scherer-2/+2
2022-08-31use derive proc macro to impl SessionDiagnosticYuanheng Li-313/+85
fixes `SessionSubdiagnostic` to accept multiple attributes emitting list of fluent message remains unresolved
2022-08-30Rework SessionSubdiagnostic derive to support multipart_suggestionXiretza-48/+278
2022-08-30Unify indentation in subdiagnostic-derive testXiretza-16/+16
2022-08-30SessionSubdiagnostic: make `#[applicability]` optionalXiretza-47/+9
2022-08-24translations: rename warn_ to warningLuis Cardoso-23/+22
The macro warn_ was named like that because it the keyword warn is a built-in attribute and at the time this macro was created the word 'warning' was also taken. However it is no longer the case and we can rename warn_ to warning.
2022-08-21Replace #[lint/warning/error] with #[diag]Xiretza-212/+285
2022-08-21Disallow #[primary_span] on LintDiagnosticsXiretza-1/+17
2022-08-21Make derived SessionDiagnostics generic on diagnostic levelXiretza-79/+47
Deriving SessionDiagnostic on a type no longer forces that diagnostic to be one of warning, error, or fatal. The level is instead decided when the struct is passed to the respective Handler::emit_*() method.
2022-08-21Add Handler::struct_diagnostic()Xiretza-1/+1
This unifies the struct_{warn,error,fatal}() methods in one generic method.
2022-07-15macros: support adding warnings to diagsDavid Wood-3/+22
Both diagnostic and subdiagnostic derives were missing the ability to add warnings to diagnostics - this is made more difficult by the `warn` attribute already existing, so this name being unavailable for the derives to use. `#[warn_]` is used instead, which requires special-casing so that `{span_,}warn` is called instead of `{span_,}warn_`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-15macros: support `MultiSpan` in diag derivesDavid Wood-9/+16
Add support for `MultiSpan` with any of the attributes that work on a `Span` - requires that diagnostic logic generated for these attributes are emitted in the by-move block rather than the by-ref block that they would normally have been generated in. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-08Fixup diagnostic-derive testDaniel Xu-1/+1
2022-07-05macros: add diagnostic derive for lintsDavid Wood-2/+41
`SessionDiagnostic` isn't suitable for use on lints as whether or not it creates an error or a warning is decided at compile-time by the macro, whereas lints decide this at runtime based on the location of the lint being reported (as it will depend on the user's `allow`/`deny` attributes, etc). Re-using most of the machinery for `SessionDiagnostic`, this macro introduces a `LintDiagnostic` derive which implements a `DecorateLint` trait, taking a `LintDiagnosticBuilder` and adding to the lint according to the diagnostic struct.