summaryrefslogtreecommitdiffstats
path: root/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs')
-rw-r--r--src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
index ca77e483d..cb4cd4665 100644
--- a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
+++ b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
@@ -40,9 +40,9 @@ struct HelloWarn {}
//~^ ERROR unsupported type attribute for diagnostic derive enum
enum DiagnosticOnEnum {
Foo,
-//~^ ERROR diagnostic slug not specified
+ //~^ ERROR diagnostic slug not specified
Bar,
-//~^ ERROR diagnostic slug not specified
+ //~^ ERROR diagnostic slug not specified
}
#[derive(Diagnostic)]
@@ -211,9 +211,10 @@ struct LabelOnNonSpan {
#[diag(compiletest_example, code = "E0123")]
struct Suggest {
#[suggestion(suggestion, code = "This is the suggested code")]
- #[suggestion_short(suggestion, code = "This is the suggested code")]
- #[suggestion_hidden(suggestion, code = "This is the suggested code")]
- #[suggestion_verbose(suggestion, code = "This is the suggested code")]
+ #[suggestion(suggestion, code = "This is the suggested code", style = "normal")]
+ #[suggestion(suggestion, code = "This is the suggested code", style = "short")]
+ #[suggestion(suggestion, code = "This is the suggested code", style = "hidden")]
+ #[suggestion(suggestion, code = "This is the suggested code", style = "verbose")]
suggestion: (Span, Applicability),
}
@@ -470,7 +471,7 @@ struct NoApplicability {
}
#[derive(Subdiagnostic)]
-#[note(parser_add_paren)]
+#[note(parse_add_paren)]
struct Note;
#[derive(Diagnostic)]
@@ -536,8 +537,7 @@ struct LabelWithTrailingList {
#[derive(LintDiagnostic)]
#[diag(compiletest_example)]
-struct LintsGood {
-}
+struct LintsGood {}
#[derive(LintDiagnostic)]
#[diag(compiletest_example)]
@@ -683,7 +683,7 @@ struct RawIdentDiagnosticArg {
#[diag(compiletest_example)]
struct SubdiagnosticBad {
#[subdiagnostic(bad)]
-//~^ ERROR `#[subdiagnostic(bad)]` is not a valid attribute
+ //~^ ERROR `#[subdiagnostic(bad)]` is not a valid attribute
note: Note,
}
@@ -691,7 +691,7 @@ struct SubdiagnosticBad {
#[diag(compiletest_example)]
struct SubdiagnosticBadStr {
#[subdiagnostic = "bad"]
-//~^ ERROR `#[subdiagnostic = ...]` is not a valid attribute
+ //~^ ERROR `#[subdiagnostic = ...]` is not a valid attribute
note: Note,
}
@@ -699,7 +699,7 @@ struct SubdiagnosticBadStr {
#[diag(compiletest_example)]
struct SubdiagnosticBadTwice {
#[subdiagnostic(bad, bad)]
-//~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
+ //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
note: Note,
}
@@ -707,7 +707,7 @@ struct SubdiagnosticBadTwice {
#[diag(compiletest_example)]
struct SubdiagnosticBadLitStr {
#[subdiagnostic("bad")]
-//~^ ERROR `#[subdiagnostic("...")]` is not a valid attribute
+ //~^ ERROR `#[subdiagnostic("...")]` is not a valid attribute
note: Note,
}
@@ -715,7 +715,7 @@ struct SubdiagnosticBadLitStr {
#[diag(compiletest_example)]
struct SubdiagnosticEagerLint {
#[subdiagnostic(eager)]
-//~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
+ //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute
note: Note,
}
@@ -731,11 +731,7 @@ struct SubdiagnosticEagerCorrect {
// after the `span_suggestion` call - which breaks eager translation.
#[derive(Subdiagnostic)]
-#[suggestion_short(
- use_instead,
- applicability = "machine-applicable",
- code = "{correct}"
-)]
+#[suggestion(use_instead, applicability = "machine-applicable", code = "{correct}")]
pub(crate) struct SubdiagnosticWithSuggestion {
#[primary_span]
span: Span,
@@ -796,3 +792,10 @@ struct SuggestionsInvalidLiteral {
//~^ ERROR `code = "..."`/`code(...)` must contain only string literals
sub: Span,
}
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
+struct SuggestionStyleGood {
+ #[suggestion(code = "", style = "hidden")]
+ sub: Span,
+}