summaryrefslogtreecommitdiffstats
path: root/src/test/ui-fulldeps/session-diagnostic
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui-fulldeps/session-diagnostic')
-rw-r--r--src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs39
-rw-r--r--src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr46
-rw-r--r--src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs24
-rw-r--r--src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr11
-rw-r--r--src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs248
-rw-r--r--src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr122
6 files changed, 338 insertions, 152 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,
+}
diff --git a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
index 859c272b6..b4c211db4 100644
--- a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
+++ b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
@@ -261,41 +261,41 @@ LL | #[label(label)]
| ^^^^^^^^^^^^^^^
error: suggestion without `code = "..."`
- --> $DIR/diagnostic-derive.rs:223:5
+ --> $DIR/diagnostic-derive.rs:224:5
|
LL | #[suggestion(suggestion)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: `#[suggestion(nonsense = ...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:231:18
+ --> $DIR/diagnostic-derive.rs:232:18
|
LL | #[suggestion(nonsense = "bar")]
| ^^^^^^^^^^^^^^^^
|
- = help: only `code` and `applicability` are valid nested attributes
+ = help: only `style`, `code` and `applicability` are valid nested attributes
error: suggestion without `code = "..."`
- --> $DIR/diagnostic-derive.rs:231:5
+ --> $DIR/diagnostic-derive.rs:232:5
|
LL | #[suggestion(nonsense = "bar")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `#[suggestion(msg = ...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:240:18
+ --> $DIR/diagnostic-derive.rs:241:18
|
LL | #[suggestion(msg = "bar")]
| ^^^^^^^^^^^
|
- = help: only `code` and `applicability` are valid nested attributes
+ = help: only `style`, `code` and `applicability` are valid nested attributes
error: suggestion without `code = "..."`
- --> $DIR/diagnostic-derive.rs:240:5
+ --> $DIR/diagnostic-derive.rs:241:5
|
LL | #[suggestion(msg = "bar")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: wrong field type for suggestion
- --> $DIR/diagnostic-derive.rs:263:5
+ --> $DIR/diagnostic-derive.rs:264:5
|
LL | / #[suggestion(suggestion, code = "This is suggested code")]
LL | |
@@ -305,55 +305,55 @@ LL | | suggestion: Applicability,
= help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)`
error: specified multiple times
- --> $DIR/diagnostic-derive.rs:279:24
+ --> $DIR/diagnostic-derive.rs:280:24
|
LL | suggestion: (Span, Span, Applicability),
| ^^^^
|
note: previously specified here
- --> $DIR/diagnostic-derive.rs:279:18
+ --> $DIR/diagnostic-derive.rs:280:18
|
LL | suggestion: (Span, Span, Applicability),
| ^^^^
error: specified multiple times
- --> $DIR/diagnostic-derive.rs:287:33
+ --> $DIR/diagnostic-derive.rs:288:33
|
LL | suggestion: (Applicability, Applicability, Span),
| ^^^^^^^^^^^^^
|
note: previously specified here
- --> $DIR/diagnostic-derive.rs:287:18
+ --> $DIR/diagnostic-derive.rs:288:18
|
LL | suggestion: (Applicability, Applicability, Span),
| ^^^^^^^^^^^^^
error: `#[label = ...]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:294:5
+ --> $DIR/diagnostic-derive.rs:295:5
|
LL | #[label = "bar"]
| ^^^^^^^^^^^^^^^^
error: specified multiple times
- --> $DIR/diagnostic-derive.rs:445:44
+ --> $DIR/diagnostic-derive.rs:446:44
|
LL | #[suggestion(suggestion, code = "...", applicability = "maybe-incorrect")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: previously specified here
- --> $DIR/diagnostic-derive.rs:447:24
+ --> $DIR/diagnostic-derive.rs:448:24
|
LL | suggestion: (Span, Applicability),
| ^^^^^^^^^^^^^
error: invalid applicability
- --> $DIR/diagnostic-derive.rs:453:44
+ --> $DIR/diagnostic-derive.rs:454:44
|
LL | #[suggestion(suggestion, code = "...", applicability = "batman")]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: `#[label(foo)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:516:20
+ --> $DIR/diagnostic-derive.rs:517:20
|
LL | #[label(label, foo)]
| ^^^
@@ -361,13 +361,13 @@ LL | #[label(label, foo)]
= help: a diagnostic slug must be the first argument to the attribute
error: `#[label(foo = ...)]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:524:20
+ --> $DIR/diagnostic-derive.rs:525:20
|
LL | #[label(label, foo = "...")]
| ^^^^^^^^^^^
error: `#[label(foo(...))]` is not a valid attribute
- --> $DIR/diagnostic-derive.rs:532:20
+ --> $DIR/diagnostic-derive.rs:533:20
|
LL | #[label(label, foo("..."))]
| ^^^^^^^^^^
@@ -574,19 +574,19 @@ LL | #[subdiagnostic(eager)]
= help: eager subdiagnostics are not supported on lints
error: expected at least one string literal for `code(...)`
- --> $DIR/diagnostic-derive.rs:779:18
+ --> $DIR/diagnostic-derive.rs:775:18
|
LL | #[suggestion(code())]
| ^^^^^^
error: `code(...)` must contain only string literals
- --> $DIR/diagnostic-derive.rs:787:23
+ --> $DIR/diagnostic-derive.rs:783:23
|
LL | #[suggestion(code(foo))]
| ^^^
error: `code = "..."`/`code(...)` must contain only string literals
- --> $DIR/diagnostic-derive.rs:795:18
+ --> $DIR/diagnostic-derive.rs:791:18
|
LL | #[suggestion(code = 3)]
| ^^^^^^^^
@@ -652,7 +652,7 @@ LL | #[diag(nonsense, code = "E0123")]
| ^^^^^^^^ not found in `rustc_errors::fluent`
error[E0277]: the trait bound `Hello: IntoDiagnosticArg` is not satisfied
- --> $DIR/diagnostic-derive.rs:338:10
+ --> $DIR/diagnostic-derive.rs:339:10
|
LL | #[derive(Diagnostic)]
| ^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello`
diff --git a/src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs b/src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs
new file mode 100644
index 000000000..a0a8114e0
--- /dev/null
+++ b/src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs
@@ -0,0 +1,24 @@
+// rustc-env:CARGO_CRATE_NAME=rustc_dummy
+
+#![feature(rustc_private)]
+#![crate_type = "lib"]
+
+extern crate rustc_span;
+use rustc_span::symbol::Ident;
+use rustc_span::Span;
+
+extern crate rustc_macros;
+use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
+
+extern crate rustc_middle;
+use rustc_middle::ty::Ty;
+
+extern crate rustc_errors;
+use rustc_errors::{Applicability, MultiSpan};
+
+extern crate rustc_session;
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example, code = "E0123")]
+//~^ ERROR diagnostic slug and crate name do not match
+struct Hello {}
diff --git a/src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr b/src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr
new file mode 100644
index 000000000..dcf4af5df
--- /dev/null
+++ b/src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr
@@ -0,0 +1,11 @@
+error: diagnostic slug and crate name do not match
+ --> $DIR/enforce_slug_naming.rs:22:8
+ |
+LL | #[diag(compiletest_example, code = "E0123")]
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: slug is `compiletest_example` but the crate name is `rustc_dummy`
+ = help: expected a slug starting with `dummy_...`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs b/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs
index efec85eb5..61ac456a6 100644
--- a/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs
+++ b/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs
@@ -11,16 +11,16 @@
#![crate_type = "lib"]
extern crate rustc_errors;
+extern crate rustc_macros;
extern crate rustc_session;
extern crate rustc_span;
-extern crate rustc_macros;
use rustc_errors::Applicability;
-use rustc_span::Span;
use rustc_macros::Subdiagnostic;
+use rustc_span::Span;
#[derive(Subdiagnostic)]
-#[label(parser_add_paren)]
+#[label(parse_add_paren)]
struct A {
#[primary_span]
span: Span,
@@ -29,22 +29,22 @@ struct A {
#[derive(Subdiagnostic)]
enum B {
- #[label(parser_add_paren)]
+ #[label(parse_add_paren)]
A {
#[primary_span]
span: Span,
var: String,
},
- #[label(parser_add_paren)]
+ #[label(parse_add_paren)]
B {
#[primary_span]
span: Span,
var: String,
- }
+ },
}
#[derive(Subdiagnostic)]
-#[label(parser_add_paren)]
+#[label(parse_add_paren)]
//~^ ERROR label without `#[primary_span]` field
struct C {
var: String,
@@ -138,7 +138,7 @@ struct M {
}
#[derive(Subdiagnostic)]
-#[label(parser_add_paren, code = "...")]
+#[label(parse_add_paren, code = "...")]
//~^ ERROR `#[label(code = ...)]` is not a valid attribute
struct N {
#[primary_span]
@@ -147,7 +147,7 @@ struct N {
}
#[derive(Subdiagnostic)]
-#[label(parser_add_paren, applicability = "machine-applicable")]
+#[label(parse_add_paren, applicability = "machine-applicable")]
//~^ ERROR `#[label(applicability = ...)]` is not a valid attribute
struct O {
#[primary_span]
@@ -160,12 +160,12 @@ struct O {
//~^ ERROR cannot find attribute `foo` in this scope
//~^^ ERROR unsupported type attribute for subdiagnostic enum
enum P {
- #[label(parser_add_paren)]
+ #[label(parse_add_paren)]
A {
#[primary_span]
span: Span,
var: String,
- }
+ },
}
#[derive(Subdiagnostic)]
@@ -177,7 +177,7 @@ enum Q {
#[primary_span]
span: Span,
var: String,
- }
+ },
}
#[derive(Subdiagnostic)]
@@ -189,7 +189,7 @@ enum R {
#[primary_span]
span: Span,
var: String,
- }
+ },
}
#[derive(Subdiagnostic)]
@@ -201,7 +201,7 @@ enum S {
#[primary_span]
span: Span,
var: String,
- }
+ },
}
#[derive(Subdiagnostic)]
@@ -213,7 +213,7 @@ enum T {
#[primary_span]
span: Span,
var: String,
- }
+ },
}
#[derive(Subdiagnostic)]
@@ -225,12 +225,12 @@ enum U {
#[primary_span]
span: Span,
var: String,
- }
+ },
}
#[derive(Subdiagnostic)]
enum V {
- #[label(parser_add_paren)]
+ #[label(parse_add_paren)]
A {
#[primary_span]
span: Span,
@@ -240,11 +240,11 @@ enum V {
#[primary_span]
span: Span,
var: String,
- }
+ },
}
#[derive(Subdiagnostic)]
-#[label(parser_add_paren)]
+#[label(parse_add_paren)]
//~^ ERROR label without `#[primary_span]` field
struct W {
#[primary_span]
@@ -253,7 +253,7 @@ struct W {
}
#[derive(Subdiagnostic)]
-#[label(parser_add_paren)]
+#[label(parse_add_paren)]
struct X {
#[primary_span]
span: Span,
@@ -263,7 +263,7 @@ struct X {
}
#[derive(Subdiagnostic)]
-#[label(parser_add_paren)]
+#[label(parse_add_paren)]
struct Y {
#[primary_span]
span: Span,
@@ -274,7 +274,7 @@ struct Y {
}
#[derive(Subdiagnostic)]
-#[label(parser_add_paren)]
+#[label(parse_add_paren)]
struct Z {
#[primary_span]
span: Span,
@@ -285,7 +285,7 @@ struct Z {
}
#[derive(Subdiagnostic)]
-#[label(parser_add_paren)]
+#[label(parse_add_paren)]
struct AA {
#[primary_span]
span: Span,
@@ -296,39 +296,39 @@ struct AA {
}
#[derive(Subdiagnostic)]
-#[label(parser_add_paren)]
+#[label(parse_add_paren)]
struct AB {
#[primary_span]
span: Span,
#[skip_arg]
- z: Z
+ z: Z,
}
#[derive(Subdiagnostic)]
union AC {
-//~^ ERROR unexpected unsupported untagged union
+ //~^ ERROR unexpected unsupported untagged union
span: u32,
- b: u64
+ b: u64,
}
#[derive(Subdiagnostic)]
-#[label(parser_add_paren)]
-#[label(parser_add_paren)]
+#[label(parse_add_paren)]
+#[label(parse_add_paren)]
struct AD {
#[primary_span]
span: Span,
}
#[derive(Subdiagnostic)]
-#[label(parser_add_paren, parser_add_paren)]
-//~^ ERROR `#[label(parser_add_paren)]` is not a valid attribute
+#[label(parse_add_paren, parse_add_paren)]
+//~^ ERROR `#[label(parse_add_paren)]` is not a valid attribute
struct AE {
#[primary_span]
span: Span,
}
#[derive(Subdiagnostic)]
-#[label(parser_add_paren)]
+#[label(parse_add_paren)]
struct AF {
#[primary_span]
//~^ NOTE previously specified here
@@ -346,7 +346,7 @@ struct AG {
}
#[derive(Subdiagnostic)]
-#[suggestion(parser_add_paren, code = "...")]
+#[suggestion(parse_add_paren, code = "...")]
struct AH {
#[primary_span]
span: Span,
@@ -357,7 +357,7 @@ struct AH {
#[derive(Subdiagnostic)]
enum AI {
- #[suggestion(parser_add_paren, code = "...")]
+ #[suggestion(parse_add_paren, code = "...")]
A {
#[primary_span]
span: Span,
@@ -365,18 +365,18 @@ enum AI {
applicability: Applicability,
var: String,
},
- #[suggestion(parser_add_paren, code = "...")]
+ #[suggestion(parse_add_paren, code = "...")]
B {
#[primary_span]
span: Span,
#[applicability]
applicability: Applicability,
var: String,
- }
+ },
}
#[derive(Subdiagnostic)]
-#[suggestion(parser_add_paren, code = "...", code = "...")]
+#[suggestion(parse_add_paren, code = "...", code = "...")]
//~^ ERROR specified multiple times
//~^^ NOTE previously specified here
struct AJ {
@@ -387,7 +387,7 @@ struct AJ {
}
#[derive(Subdiagnostic)]
-#[suggestion(parser_add_paren, code = "...")]
+#[suggestion(parse_add_paren, code = "...")]
struct AK {
#[primary_span]
span: Span,
@@ -400,7 +400,7 @@ struct AK {
}
#[derive(Subdiagnostic)]
-#[suggestion(parser_add_paren, code = "...")]
+#[suggestion(parse_add_paren, code = "...")]
struct AL {
#[primary_span]
span: Span,
@@ -410,14 +410,14 @@ struct AL {
}
#[derive(Subdiagnostic)]
-#[suggestion(parser_add_paren, code = "...")]
+#[suggestion(parse_add_paren, code = "...")]
struct AM {
#[primary_span]
span: Span,
}
#[derive(Subdiagnostic)]
-#[suggestion(parser_add_paren)]
+#[suggestion(parse_add_paren)]
//~^ ERROR suggestion without `code = "..."`
struct AN {
#[primary_span]
@@ -427,7 +427,7 @@ struct AN {
}
#[derive(Subdiagnostic)]
-#[suggestion(parser_add_paren, code ="...", applicability = "foo")]
+#[suggestion(parse_add_paren, code = "...", applicability = "foo")]
//~^ ERROR invalid applicability
struct AO {
#[primary_span]
@@ -435,24 +435,24 @@ struct AO {
}
#[derive(Subdiagnostic)]
-#[help(parser_add_paren)]
+#[help(parse_add_paren)]
struct AP {
- var: String
+ var: String,
}
#[derive(Subdiagnostic)]
-#[note(parser_add_paren)]
+#[note(parse_add_paren)]
struct AQ;
#[derive(Subdiagnostic)]
-#[suggestion(parser_add_paren, code = "...")]
+#[suggestion(parse_add_paren, code = "...")]
//~^ ERROR suggestion without `#[primary_span]` field
struct AR {
var: String,
}
#[derive(Subdiagnostic)]
-#[suggestion(parser_add_paren, code ="...", applicability = "machine-applicable")]
+#[suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")]
struct AS {
#[primary_span]
span: Span,
@@ -462,16 +462,16 @@ struct AS {
#[label]
//~^ ERROR unsupported type attribute for subdiagnostic enum
enum AT {
- #[label(parser_add_paren)]
+ #[label(parse_add_paren)]
A {
#[primary_span]
span: Span,
var: String,
- }
+ },
}
#[derive(Subdiagnostic)]
-#[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")]
+#[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")]
struct AU {
#[primary_span]
span: Span,
@@ -479,7 +479,7 @@ struct AU {
}
#[derive(Subdiagnostic)]
-#[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")]
+#[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")]
//~^ ERROR `var` doesn't refer to a field on this type
struct AV {
#[primary_span]
@@ -488,37 +488,37 @@ struct AV {
#[derive(Subdiagnostic)]
enum AW {
- #[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")]
+ #[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")]
A {
#[primary_span]
span: Span,
var: String,
- }
+ },
}
#[derive(Subdiagnostic)]
enum AX {
- #[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")]
-//~^ ERROR `var` doesn't refer to a field on this type
+ #[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")]
+ //~^ ERROR `var` doesn't refer to a field on this type
A {
#[primary_span]
span: Span,
- }
+ },
}
#[derive(Subdiagnostic)]
-#[warning(parser_add_paren)]
+#[warning(parse_add_paren)]
struct AY {}
#[derive(Subdiagnostic)]
-#[warning(parser_add_paren)]
+#[warning(parse_add_paren)]
struct AZ {
#[primary_span]
span: Span,
}
#[derive(Subdiagnostic)]
-#[suggestion(parser_add_paren, code = "...")]
+#[suggestion(parse_add_paren, code = "...")]
//~^ ERROR suggestion without `#[primary_span]` field
struct BA {
#[suggestion_part]
@@ -533,7 +533,7 @@ struct BA {
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren, code = "...", applicability = "machine-applicable")]
+#[multipart_suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")]
//~^ ERROR multipart suggestion without any `#[suggestion_part(...)]` fields
//~| ERROR `#[multipart_suggestion(code = ...)]` is not a valid attribute
struct BBa {
@@ -541,7 +541,7 @@ struct BBa {
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
+#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")]
struct BBb {
#[suggestion_part]
//~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
@@ -549,7 +549,7 @@ struct BBb {
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
+#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")]
struct BBc {
#[suggestion_part()]
//~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
@@ -557,7 +557,7 @@ struct BBc {
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren)]
+#[multipart_suggestion(parse_add_paren)]
//~^ ERROR multipart suggestion without any `#[suggestion_part(...)]` fields
struct BC {
#[primary_span]
@@ -566,7 +566,7 @@ struct BC {
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren)]
+#[multipart_suggestion(parse_add_paren)]
struct BD {
#[suggestion_part]
//~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
@@ -586,7 +586,7 @@ struct BD {
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
+#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")]
struct BE {
#[suggestion_part(code = "...", code = ",,,")]
//~^ ERROR specified multiple times
@@ -595,7 +595,7 @@ struct BE {
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
+#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")]
struct BF {
#[suggestion_part(code = "(")]
first: Span,
@@ -604,7 +604,7 @@ struct BF {
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren)]
+#[multipart_suggestion(parse_add_paren)]
struct BG {
#[applicability]
appl: Applicability,
@@ -615,7 +615,7 @@ struct BG {
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
+#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")]
struct BH {
#[applicability]
//~^ ERROR `#[applicability]` has no effect
@@ -627,14 +627,14 @@ struct BH {
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")]
+#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")]
struct BI {
#[suggestion_part(code = "")]
spans: Vec<Span>,
}
#[derive(Subdiagnostic)]
-#[label(parser_add_paren)]
+#[label(parse_add_paren)]
struct BJ {
#[primary_span]
span: Span,
@@ -643,7 +643,7 @@ struct BJ {
/// with a doc comment on the type..
#[derive(Subdiagnostic)]
-#[label(parser_add_paren)]
+#[label(parse_add_paren)]
struct BK {
/// ..and the field
#[primary_span]
@@ -654,16 +654,16 @@ struct BK {
#[derive(Subdiagnostic)]
enum BL {
/// ..and the variant..
- #[label(parser_add_paren)]
+ #[label(parse_add_paren)]
Foo {
/// ..and the field
#[primary_span]
span: Span,
- }
+ },
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren)]
+#[multipart_suggestion(parse_add_paren)]
struct BM {
#[suggestion_part(code("foo"))]
//~^ ERROR expected exactly one string literal for `code = ...`
@@ -672,7 +672,7 @@ struct BM {
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren)]
+#[multipart_suggestion(parse_add_paren)]
struct BN {
#[suggestion_part(code("foo", "bar"))]
//~^ ERROR expected exactly one string literal for `code = ...`
@@ -681,7 +681,7 @@ struct BN {
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren)]
+#[multipart_suggestion(parse_add_paren)]
struct BO {
#[suggestion_part(code(3))]
//~^ ERROR expected exactly one string literal for `code = ...`
@@ -690,7 +690,7 @@ struct BO {
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren)]
+#[multipart_suggestion(parse_add_paren)]
struct BP {
#[suggestion_part(code())]
//~^ ERROR expected exactly one string literal for `code = ...`
@@ -699,10 +699,102 @@ struct BP {
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parser_add_paren)]
+#[multipart_suggestion(parse_add_paren)]
struct BQ {
#[suggestion_part(code = 3)]
//~^ ERROR `code = "..."`/`code(...)` must contain only string literals
span: Span,
r#type: String,
}
+
+#[derive(Subdiagnostic)]
+#[suggestion(parse_add_paren, code = "")]
+struct SuggestionStyleDefault {
+ #[primary_span]
+ sub: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[suggestion(parse_add_paren, code = "", style = "short")]
+struct SuggestionStyleShort {
+ #[primary_span]
+ sub: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[suggestion(parse_add_paren, code = "", style = "hidden")]
+struct SuggestionStyleHidden {
+ #[primary_span]
+ sub: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[suggestion(parse_add_paren, code = "", style = "verbose")]
+struct SuggestionStyleVerbose {
+ #[primary_span]
+ sub: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[suggestion(parse_add_paren, code = "", style = "tool-only")]
+struct SuggestionStyleToolOnly {
+ #[primary_span]
+ sub: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[suggestion(parse_add_paren, code = "", style = "hidden", style = "normal")]
+//~^ ERROR specified multiple times
+//~| NOTE previously specified here
+struct SuggestionStyleTwice {
+ #[primary_span]
+ sub: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[suggestion_hidden(parse_add_paren, code = "")]
+//~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute
+struct SuggestionStyleOldSyntax {
+ #[primary_span]
+ sub: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[suggestion_hidden(parse_add_paren, code = "", style = "normal")]
+//~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute
+struct SuggestionStyleOldAndNewSyntax {
+ #[primary_span]
+ sub: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[suggestion(parse_add_paren, code = "", style = "foo")]
+//~^ ERROR invalid suggestion style
+struct SuggestionStyleInvalid1 {
+ #[primary_span]
+ sub: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[suggestion(parse_add_paren, code = "", style = 42)]
+//~^ ERROR `#[suggestion(style = ...)]` is not a valid attribute
+struct SuggestionStyleInvalid2 {
+ #[primary_span]
+ sub: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[suggestion(parse_add_paren, code = "", style)]
+//~^ ERROR `#[suggestion(style)]` is not a valid attribute
+struct SuggestionStyleInvalid3 {
+ #[primary_span]
+ sub: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[suggestion(parse_add_paren, code = "", style("foo"))]
+//~^ ERROR `#[suggestion(style(...))]` is not a valid attribute
+struct SuggestionStyleInvalid4 {
+ #[primary_span]
+ sub: Span,
+}
diff --git a/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr b/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr
index a85a8711e..b594fa6cd 100644
--- a/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr
+++ b/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr
@@ -1,7 +1,7 @@
error: label without `#[primary_span]` field
--> $DIR/subdiagnostic-derive.rs:47:1
|
-LL | / #[label(parser_add_paren)]
+LL | / #[label(parse_add_paren)]
LL | |
LL | | struct C {
LL | | var: String,
@@ -81,16 +81,16 @@ LL | #[label()]
| ^^^^^^^^^^
error: `#[label(code = ...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:141:27
+ --> $DIR/subdiagnostic-derive.rs:141:26
|
-LL | #[label(parser_add_paren, code = "...")]
- | ^^^^^^^^^^^^
+LL | #[label(parse_add_paren, code = "...")]
+ | ^^^^^^^^^^^^
error: `#[label(applicability = ...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:150:27
+ --> $DIR/subdiagnostic-derive.rs:150:26
|
-LL | #[label(parser_add_paren, applicability = "machine-applicable")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[label(parse_add_paren, applicability = "machine-applicable")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: unsupported type attribute for subdiagnostic enum
--> $DIR/subdiagnostic-derive.rs:159:1
@@ -143,7 +143,7 @@ LL | #[primary_span]
error: label without `#[primary_span]` field
--> $DIR/subdiagnostic-derive.rs:247:1
|
-LL | / #[label(parser_add_paren)]
+LL | / #[label(parse_add_paren)]
LL | |
LL | | struct W {
LL | | #[primary_span]
@@ -186,15 +186,15 @@ error: unexpected unsupported untagged union
LL | / union AC {
LL | |
LL | | span: u32,
-LL | | b: u64
+LL | | b: u64,
LL | | }
| |_^
-error: `#[label(parser_add_paren)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:323:27
+error: `#[label(parse_add_paren)]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:323:26
|
-LL | #[label(parser_add_paren, parser_add_paren)]
- | ^^^^^^^^^^^^^^^^
+LL | #[label(parse_add_paren, parse_add_paren)]
+ | ^^^^^^^^^^^^^^^
|
= help: a diagnostic slug must be the first argument to the attribute
@@ -217,16 +217,16 @@ LL | struct AG {
| ^^
error: specified multiple times
- --> $DIR/subdiagnostic-derive.rs:379:46
+ --> $DIR/subdiagnostic-derive.rs:379:45
|
-LL | #[suggestion(parser_add_paren, code = "...", code = "...")]
- | ^^^^^^^^^^^^
+LL | #[suggestion(parse_add_paren, code = "...", code = "...")]
+ | ^^^^^^^^^^^^
|
note: previously specified here
- --> $DIR/subdiagnostic-derive.rs:379:32
+ --> $DIR/subdiagnostic-derive.rs:379:31
|
-LL | #[suggestion(parser_add_paren, code = "...", code = "...")]
- | ^^^^^^^^^^^^
+LL | #[suggestion(parse_add_paren, code = "...", code = "...")]
+ | ^^^^^^^^^^^^
error: specified multiple times
--> $DIR/subdiagnostic-derive.rs:397:5
@@ -249,19 +249,19 @@ LL | #[applicability]
error: suggestion without `code = "..."`
--> $DIR/subdiagnostic-derive.rs:420:1
|
-LL | #[suggestion(parser_add_paren)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[suggestion(parse_add_paren)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: invalid applicability
--> $DIR/subdiagnostic-derive.rs:430:45
|
-LL | #[suggestion(parser_add_paren, code ="...", applicability = "foo")]
+LL | #[suggestion(parse_add_paren, code = "...", applicability = "foo")]
| ^^^^^^^^^^^^^^^^^^^^^
error: suggestion without `#[primary_span]` field
--> $DIR/subdiagnostic-derive.rs:448:1
|
-LL | / #[suggestion(parser_add_paren, code = "...")]
+LL | / #[suggestion(parse_add_paren, code = "...")]
LL | |
LL | | struct AR {
LL | | var: String,
@@ -277,13 +277,13 @@ LL | #[label]
error: `var` doesn't refer to a field on this type
--> $DIR/subdiagnostic-derive.rs:482:38
|
-LL | #[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")]
+LL | #[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")]
| ^^^^^^^
error: `var` doesn't refer to a field on this type
--> $DIR/subdiagnostic-derive.rs:501:42
|
-LL | #[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")]
+LL | #[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")]
| ^^^^^^^
error: `#[suggestion_part]` is not a valid attribute
@@ -305,7 +305,7 @@ LL | #[suggestion_part(code = "...")]
error: suggestion without `#[primary_span]` field
--> $DIR/subdiagnostic-derive.rs:521:1
|
-LL | / #[suggestion(parser_add_paren, code = "...")]
+LL | / #[suggestion(parse_add_paren, code = "...")]
LL | |
LL | | struct BA {
LL | | #[suggestion_part]
@@ -315,17 +315,17 @@ LL | | }
| |_^
error: `#[multipart_suggestion(code = ...)]` is not a valid attribute
- --> $DIR/subdiagnostic-derive.rs:536:42
+ --> $DIR/subdiagnostic-derive.rs:536:41
|
-LL | #[multipart_suggestion(parser_add_paren, code = "...", applicability = "machine-applicable")]
- | ^^^^^^^^^^^^
+LL | #[multipart_suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")]
+ | ^^^^^^^^^^^^
|
- = help: only `applicability` is a valid nested attributes
+ = help: only `style` and `applicability` are valid nested attributes
error: multipart suggestion without any `#[suggestion_part(...)]` fields
--> $DIR/subdiagnostic-derive.rs:536:1
|
-LL | / #[multipart_suggestion(parser_add_paren, code = "...", applicability = "machine-applicable")]
+LL | / #[multipart_suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")]
LL | |
LL | |
LL | | struct BBa {
@@ -356,7 +356,7 @@ LL | #[primary_span]
error: multipart suggestion without any `#[suggestion_part(...)]` fields
--> $DIR/subdiagnostic-derive.rs:560:1
|
-LL | / #[multipart_suggestion(parser_add_paren)]
+LL | / #[multipart_suggestion(parse_add_paren)]
LL | |
LL | | struct BC {
LL | | #[primary_span]
@@ -445,6 +445,62 @@ error: `code = "..."`/`code(...)` must contain only string literals
LL | #[suggestion_part(code = 3)]
| ^^^^^^^^
+error: specified multiple times
+ --> $DIR/subdiagnostic-derive.rs:746:60
+ |
+LL | #[suggestion(parse_add_paren, code = "", style = "hidden", style = "normal")]
+ | ^^^^^^^^^^^^^^^^
+ |
+note: previously specified here
+ --> $DIR/subdiagnostic-derive.rs:746:42
+ |
+LL | #[suggestion(parse_add_paren, code = "", style = "hidden", style = "normal")]
+ | ^^^^^^^^^^^^^^^^
+
+error: `#[suggestion_hidden(...)]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:755:1
+ |
+LL | #[suggestion_hidden(parse_add_paren, code = "")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: Use `#[suggestion(..., style = "hidden")]` instead
+
+error: `#[suggestion_hidden(...)]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:763:1
+ |
+LL | #[suggestion_hidden(parse_add_paren, code = "", style = "normal")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: Use `#[suggestion(..., style = "hidden")]` instead
+
+error: invalid suggestion style
+ --> $DIR/subdiagnostic-derive.rs:771:50
+ |
+LL | #[suggestion(parse_add_paren, code = "", style = "foo")]
+ | ^^^^^
+ |
+ = help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only`
+
+error: `#[suggestion(style = ...)]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:779:42
+ |
+LL | #[suggestion(parse_add_paren, code = "", style = 42)]
+ | ^^^^^^^^^^
+
+error: `#[suggestion(style)]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:787:42
+ |
+LL | #[suggestion(parse_add_paren, code = "", style)]
+ | ^^^^^
+ |
+ = help: a diagnostic slug must be the first argument to the attribute
+
+error: `#[suggestion(style(...))]` is not a valid attribute
+ --> $DIR/subdiagnostic-derive.rs:795:42
+ |
+LL | #[suggestion(parse_add_paren, code = "", style("foo"))]
+ | ^^^^^^^^^^^^
+
error: cannot find attribute `foo` in this scope
--> $DIR/subdiagnostic-derive.rs:63:3
|
@@ -505,6 +561,6 @@ error[E0425]: cannot find value `slug` in module `rustc_errors::fluent`
LL | #[label(slug)]
| ^^^^ not found in `rustc_errors::fluent`
-error: aborting due to 72 previous errors
+error: aborting due to 79 previous errors
For more information about this error, try `rustc --explain E0425`.