summaryrefslogtreecommitdiffstats
path: root/tests/ui/diagnostic_namespace/on_unimplemented
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/diagnostic_namespace/on_unimplemented')
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.rs67
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr305
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs53
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr199
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.rs7
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.stderr12
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs22
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr63
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.rs18
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.stderr47
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.rs11
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.stderr24
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/report_warning_on_duplicated_options.rs25
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/report_warning_on_duplicated_options.stderr67
14 files changed, 920 insertions, 0 deletions
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.rs b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.rs
new file mode 100644
index 000000000..eb985c062
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.rs
@@ -0,0 +1,67 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic::on_unimplemented(
+ on(_Self = "&str"),
+ //~^WARN malformed `on_unimplemented` attribute
+ //~|WARN malformed `on_unimplemented` attribute
+ message = "trait has `{Self}` and `{T}` as params",
+ label = "trait has `{Self}` and `{T}` as params",
+ note = "trait has `{Self}` and `{T}` as params",
+ parent_label = "in this scope",
+ //~^WARN malformed `on_unimplemented` attribute
+ //~|WARN malformed `on_unimplemented` attribute
+ append_const_msg
+ //~^WARN malformed `on_unimplemented` attribute
+ //~|WARN malformed `on_unimplemented` attribute
+)]
+trait Foo<T> {}
+
+#[diagnostic::on_unimplemented = "Message"]
+//~^WARN malformed `on_unimplemented` attribute
+//~|WARN malformed `on_unimplemented` attribute
+trait Bar {}
+
+#[diagnostic::on_unimplemented(message = "Not allowed to apply it on a impl")]
+//~^WARN #[diagnostic::on_unimplemented]` can only be applied to trait definitions
+impl Bar for i32 {}
+
+// cannot use special rustc_on_unimplement symbols
+// in the format string
+#[diagnostic::on_unimplemented(
+ message = "{from_desugaring}{direct}{cause}{integral}{integer}",
+ //~^WARN there is no parameter `from_desugaring` on trait `Baz`
+ //~|WARN there is no parameter `from_desugaring` on trait `Baz`
+ //~|WARN there is no parameter `direct` on trait `Baz`
+ //~|WARN there is no parameter `direct` on trait `Baz`
+ //~|WARN there is no parameter `cause` on trait `Baz`
+ //~|WARN there is no parameter `cause` on trait `Baz`
+ //~|WARN there is no parameter `integral` on trait `Baz`
+ //~|WARN there is no parameter `integral` on trait `Baz`
+ //~|WARN there is no parameter `integer` on trait `Baz`
+ //~|WARN there is no parameter `integer` on trait `Baz`
+ label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+ //~^WARN there is no parameter `float` on trait `Baz`
+ //~|WARN there is no parameter `float` on trait `Baz`
+ //~|WARN there is no parameter `_Self` on trait `Baz`
+ //~|WARN there is no parameter `_Self` on trait `Baz`
+ //~|WARN there is no parameter `crate_local` on trait `Baz`
+ //~|WARN there is no parameter `crate_local` on trait `Baz`
+ //~|WARN there is no parameter `Trait` on trait `Baz`
+ //~|WARN there is no parameter `Trait` on trait `Baz`
+ //~|WARN there is no parameter `ItemContext` on trait `Baz`
+ //~|WARN there is no parameter `ItemContext` on trait `Baz`
+)]
+trait Baz {}
+
+fn takes_foo(_: impl Foo<i32>) {}
+fn takes_bar(_: impl Bar) {}
+fn takes_baz(_: impl Baz) {}
+
+fn main() {
+ takes_foo(());
+ //~^ERROR trait has `()` and `i32` as params
+ takes_bar(());
+ //~^ERROR the trait bound `(): Bar` is not satisfied
+ takes_baz(());
+ //~^ERROR {from_desugaring}{direct}{cause}{integral}{integer}
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr
new file mode 100644
index 000000000..75a701f0b
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr
@@ -0,0 +1,305 @@
+warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definitions
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:24:1
+ |
+LL | #[diagnostic::on_unimplemented(message = "Not allowed to apply it on a impl")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:4:5
+ |
+LL | on(_Self = "&str"),
+ | ^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:10:5
+ |
+LL | parent_label = "in this scope",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:13:5
+ |
+LL | append_const_msg
+ | ^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:19:32
+ |
+LL | #[diagnostic::on_unimplemented = "Message"]
+ | ^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+
+warning: there is no parameter `from_desugaring` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:31:5
+ |
+LL | message = "{from_desugaring}{direct}{cause}{integral}{integer}",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+
+warning: there is no parameter `direct` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:31:5
+ |
+LL | message = "{from_desugaring}{direct}{cause}{integral}{integer}",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+
+warning: there is no parameter `cause` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:31:5
+ |
+LL | message = "{from_desugaring}{direct}{cause}{integral}{integer}",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+
+warning: there is no parameter `integral` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:31:5
+ |
+LL | message = "{from_desugaring}{direct}{cause}{integral}{integer}",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+
+warning: there is no parameter `integer` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:31:5
+ |
+LL | message = "{from_desugaring}{direct}{cause}{integral}{integer}",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+
+warning: there is no parameter `float` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:42:5
+ |
+LL | label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+
+warning: there is no parameter `_Self` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:42:5
+ |
+LL | label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+
+warning: there is no parameter `crate_local` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:42:5
+ |
+LL | label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+
+warning: there is no parameter `Trait` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:42:5
+ |
+LL | label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+
+warning: there is no parameter `ItemContext` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:42:5
+ |
+LL | label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:4:5
+ |
+LL | on(_Self = "&str"),
+ | ^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:10:5
+ |
+LL | parent_label = "in this scope",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:13:5
+ |
+LL | append_const_msg
+ | ^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: trait has `()` and `i32` as params
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:61:15
+ |
+LL | takes_foo(());
+ | --------- ^^ trait has `()` and `i32` as params
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Foo<i32>` is not implemented for `()`
+ = note: trait has `()` and `i32` as params
+help: this trait has no implementations, consider adding one
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:17:1
+ |
+LL | trait Foo<T> {}
+ | ^^^^^^^^^^^^
+note: required by a bound in `takes_foo`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:56:22
+ |
+LL | fn takes_foo(_: impl Foo<i32>) {}
+ | ^^^^^^^^ required by this bound in `takes_foo`
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:19:32
+ |
+LL | #[diagnostic::on_unimplemented = "Message"]
+ | ^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: the trait bound `(): Bar` is not satisfied
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:63:15
+ |
+LL | takes_bar(());
+ | --------- ^^ the trait `Bar` is not implemented for `()`
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Bar` is implemented for `i32`
+note: required by a bound in `takes_bar`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:57:22
+ |
+LL | fn takes_bar(_: impl Bar) {}
+ | ^^^ required by this bound in `takes_bar`
+
+warning: there is no parameter `from_desugaring` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:31:5
+ |
+LL | message = "{from_desugaring}{direct}{cause}{integral}{integer}",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: there is no parameter `direct` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:31:5
+ |
+LL | message = "{from_desugaring}{direct}{cause}{integral}{integer}",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: there is no parameter `cause` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:31:5
+ |
+LL | message = "{from_desugaring}{direct}{cause}{integral}{integer}",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: there is no parameter `integral` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:31:5
+ |
+LL | message = "{from_desugaring}{direct}{cause}{integral}{integer}",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: there is no parameter `integer` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:31:5
+ |
+LL | message = "{from_desugaring}{direct}{cause}{integral}{integer}",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: there is no parameter `float` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:42:5
+ |
+LL | label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: there is no parameter `_Self` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:42:5
+ |
+LL | label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: there is no parameter `crate_local` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:42:5
+ |
+LL | label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: there is no parameter `Trait` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:42:5
+ |
+LL | label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: there is no parameter `ItemContext` on trait `Baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:42:5
+ |
+LL | label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: {from_desugaring}{direct}{cause}{integral}{integer}
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:65:15
+ |
+LL | takes_baz(());
+ | --------- ^^ {float}{_Self}{crate_local}{Trait}{ItemContext}
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Baz` is not implemented for `()`
+help: this trait has no implementations, consider adding one
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:54:1
+ |
+LL | trait Baz {}
+ | ^^^^^^^^^
+note: required by a bound in `takes_baz`
+ --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:58:22
+ |
+LL | fn takes_baz(_: impl Baz) {}
+ | ^^^ required by this bound in `takes_baz`
+
+error: aborting due to 3 previous errors; 29 warnings emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs
new file mode 100644
index 000000000..12fe98817
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs
@@ -0,0 +1,53 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic::on_unimplemented(unsupported = "foo")]
+//~^WARN malformed `on_unimplemented` attribute
+//~|WARN malformed `on_unimplemented` attribute
+trait Foo {}
+
+#[diagnostic::on_unimplemented(message = "Baz")]
+//~^WARN `#[diagnostic::on_unimplemented]` can only be applied to trait definitions
+struct Bar {}
+
+#[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
+//~^WARN malformed `on_unimplemented` attribute
+//~|WARN malformed `on_unimplemented` attribute
+trait Baz {}
+
+#[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
+//~^WARN malformed `on_unimplemented` attribute
+//~|WARN malformed `on_unimplemented` attribute
+trait Boom {}
+
+#[diagnostic::on_unimplemented = "boom"]
+//~^WARN malformed `on_unimplemented` attribute
+trait Doom {}
+
+#[diagnostic::on_unimplemented]
+//~^WARN missing options for `on_unimplemented` attribute
+//~|WARN missing options for `on_unimplemented` attribute
+trait Whatever {}
+
+#[diagnostic::on_unimplemented(message = "{DoesNotExist}")]
+//~^WARN there is no parameter `DoesNotExist` on trait `Test`
+//~|WARN there is no parameter `DoesNotExist` on trait `Test`
+trait Test {}
+
+fn take_foo(_: impl Foo) {}
+fn take_baz(_: impl Baz) {}
+fn take_boom(_: impl Boom) {}
+fn take_whatever(_: impl Whatever) {}
+fn take_test(_: impl Test) {}
+
+fn main() {
+ take_foo(1_i32);
+ //~^ERROR the trait bound `i32: Foo` is not satisfied
+ take_baz(1_i32);
+ //~^ERROR Boom
+ take_boom(1_i32);
+ //~^ERROR Boom
+ take_whatever(1_i32);
+ //~^ERROR the trait bound `i32: Whatever` is not satisfied
+ take_test(());
+ //~^ERROR {DoesNotExist}
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr
new file mode 100644
index 000000000..11263580b
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr
@@ -0,0 +1,199 @@
+warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definitions
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:8:1
+ |
+LL | #[diagnostic::on_unimplemented(message = "Baz")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32
+ |
+LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
+ | ^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:12:50
+ |
+LL | #[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
+ | ^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:17:50
+ |
+LL | #[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:22:32
+ |
+LL | #[diagnostic::on_unimplemented = "boom"]
+ | ^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+
+warning: missing options for `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:1
+ |
+LL | #[diagnostic::on_unimplemented]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: at least one of the `message`, `note` and `label` options are expected
+
+warning: there is no parameter `DoesNotExist` on trait `Test`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:31:32
+ |
+LL | #[diagnostic::on_unimplemented(message = "{DoesNotExist}")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32
+ |
+LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
+ | ^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:43:14
+ |
+LL | take_foo(1_i32);
+ | -------- ^^^^^ the trait `Foo` is not implemented for `i32`
+ | |
+ | required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:6:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
+note: required by a bound in `take_foo`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:36:21
+ |
+LL | fn take_foo(_: impl Foo) {}
+ | ^^^ required by this bound in `take_foo`
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:12:50
+ |
+LL | #[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
+ | ^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: Boom
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:45:14
+ |
+LL | take_baz(1_i32);
+ | -------- ^^^^^ the trait `Baz` is not implemented for `i32`
+ | |
+ | required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:15:1
+ |
+LL | trait Baz {}
+ | ^^^^^^^^^
+note: required by a bound in `take_baz`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:37:21
+ |
+LL | fn take_baz(_: impl Baz) {}
+ | ^^^ required by this bound in `take_baz`
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:17:50
+ |
+LL | #[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: Boom
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:47:15
+ |
+LL | take_boom(1_i32);
+ | --------- ^^^^^ the trait `Boom` is not implemented for `i32`
+ | |
+ | required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:20:1
+ |
+LL | trait Boom {}
+ | ^^^^^^^^^^
+note: required by a bound in `take_boom`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:38:22
+ |
+LL | fn take_boom(_: impl Boom) {}
+ | ^^^^ required by this bound in `take_boom`
+
+warning: missing options for `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:1
+ |
+LL | #[diagnostic::on_unimplemented]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: at least one of the `message`, `note` and `label` options are expected
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: the trait bound `i32: Whatever` is not satisfied
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:49:19
+ |
+LL | take_whatever(1_i32);
+ | ------------- ^^^^^ the trait `Whatever` is not implemented for `i32`
+ | |
+ | required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:29:1
+ |
+LL | trait Whatever {}
+ | ^^^^^^^^^^^^^^
+note: required by a bound in `take_whatever`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:39:26
+ |
+LL | fn take_whatever(_: impl Whatever) {}
+ | ^^^^^^^^ required by this bound in `take_whatever`
+
+warning: there is no parameter `DoesNotExist` on trait `Test`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:31:32
+ |
+LL | #[diagnostic::on_unimplemented(message = "{DoesNotExist}")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expect either a generic argument name or `{Self}` as format argument
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: {DoesNotExist}
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:51:15
+ |
+LL | take_test(());
+ | --------- ^^ the trait `Test` is not implemented for `()`
+ | |
+ | required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:34:1
+ |
+LL | trait Test {}
+ | ^^^^^^^^^^
+note: required by a bound in `take_test`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:40:22
+ |
+LL | fn take_test(_: impl Test) {}
+ | ^^^^ required by this bound in `take_test`
+
+error: aborting due to 5 previous errors; 12 warnings emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.rs b/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.rs
new file mode 100644
index 000000000..609a840c1
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.rs
@@ -0,0 +1,7 @@
+#[diagnostic::on_unimplemented(message = "Foo")]
+//~^ERROR `#[diagnostic]` attribute name space is experimental [E0658]
+pub trait Bar {
+}
+
+fn main() {
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.stderr
new file mode 100644
index 000000000..82e3b709f
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.stderr
@@ -0,0 +1,12 @@
+error[E0658]: `#[diagnostic]` attribute name space is experimental
+ --> $DIR/feature-gate-diagnostic_on_unimplemented.rs:1:3
+ |
+LL | #[diagnostic::on_unimplemented(message = "Foo")]
+ | ^^^^^^^^^^
+ |
+ = note: see issue #111996 <https://github.com/rust-lang/rust/issues/111996> for more information
+ = help: add `#![feature(diagnostic_namespace)]` to the crate attributes to enable
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs
new file mode 100644
index 000000000..0893f29c4
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs
@@ -0,0 +1,22 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic::on_unimplemented(
+ if(Self = "()"),
+ //~^WARN malformed `on_unimplemented` attribute
+ //~|WARN malformed `on_unimplemented` attribute
+ message = "custom message",
+ note = "custom note"
+)]
+#[diagnostic::on_unimplemented(message = "fallback!!")]
+//~^ `message` is ignored due to previous definition of `message`
+//~| `message` is ignored due to previous definition of `message`
+#[diagnostic::on_unimplemented(label = "fallback label")]
+#[diagnostic::on_unimplemented(note = "fallback note")]
+trait Foo {}
+
+fn takes_foo(_: impl Foo) {}
+
+fn main() {
+ takes_foo(());
+ //~^ERROR custom message
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr
new file mode 100644
index 000000000..e00846da7
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr
@@ -0,0 +1,63 @@
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:4:5
+ |
+LL | if(Self = "()"),
+ | ^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
+
+warning: `message` is ignored due to previous definition of `message`
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:10:32
+ |
+LL | message = "custom message",
+ | -------------------------- `message` is first declared here
+...
+LL | #[diagnostic::on_unimplemented(message = "fallback!!")]
+ | ^^^^^^^^^^^^^^^^^^^^^^ `message` is already declared here
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:4:5
+ |
+LL | if(Self = "()"),
+ | ^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: `message` is ignored due to previous definition of `message`
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:10:32
+ |
+LL | message = "custom message",
+ | -------------------------- `message` is first declared here
+...
+LL | #[diagnostic::on_unimplemented(message = "fallback!!")]
+ | ^^^^^^^^^^^^^^^^^^^^^^ `message` is already declared here
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: custom message
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:20:15
+ |
+LL | takes_foo(());
+ | --------- ^^ fallback label
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Foo` is not implemented for `()`
+ = note: custom note
+ = note: fallback note
+help: this trait has no implementations, consider adding one
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:15:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
+note: required by a bound in `takes_foo`
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:17:22
+ |
+LL | fn takes_foo(_: impl Foo) {}
+ | ^^^ required by this bound in `takes_foo`
+
+error: aborting due to 1 previous error; 4 warnings emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.rs b/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.rs
new file mode 100644
index 000000000..34cdb99c7
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.rs
@@ -0,0 +1,18 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic::on_unimplemented(message = "Foo", label = "Bar", note = "Baz", note = "Boom")]
+trait Foo {}
+
+#[diagnostic::on_unimplemented(message = "Bar", label = "Foo", note = "Baz")]
+#[diagnostic::on_unimplemented(note = "Baz2")]
+trait Bar {}
+
+fn takes_foo(_: impl Foo) {}
+fn takes_bar(_: impl Bar) {}
+
+fn main() {
+ takes_foo(());
+ //~^ERROR Foo
+ takes_bar(());
+ //~^ERROR Bar
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.stderr
new file mode 100644
index 000000000..c72321d46
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.stderr
@@ -0,0 +1,47 @@
+error[E0277]: Foo
+ --> $DIR/multiple_notes.rs:14:15
+ |
+LL | takes_foo(());
+ | --------- ^^ Bar
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Foo` is not implemented for `()`
+ = note: Baz
+ = note: Boom
+help: this trait has no implementations, consider adding one
+ --> $DIR/multiple_notes.rs:4:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
+note: required by a bound in `takes_foo`
+ --> $DIR/multiple_notes.rs:10:22
+ |
+LL | fn takes_foo(_: impl Foo) {}
+ | ^^^ required by this bound in `takes_foo`
+
+error[E0277]: Bar
+ --> $DIR/multiple_notes.rs:16:15
+ |
+LL | takes_bar(());
+ | --------- ^^ Foo
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Bar` is not implemented for `()`
+ = note: Baz
+ = note: Baz2
+help: this trait has no implementations, consider adding one
+ --> $DIR/multiple_notes.rs:8:1
+ |
+LL | trait Bar {}
+ | ^^^^^^^^^
+note: required by a bound in `takes_bar`
+ --> $DIR/multiple_notes.rs:11:22
+ |
+LL | fn takes_bar(_: impl Bar) {}
+ | ^^^ required by this bound in `takes_bar`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.rs b/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.rs
new file mode 100644
index 000000000..797edbc9e
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.rs
@@ -0,0 +1,11 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic::on_unimplemented(message = "Foo", label = "Bar", note = "Baz")]
+trait Foo {}
+
+fn takes_foo(_: impl Foo) {}
+
+fn main() {
+ takes_foo(());
+ //~^ERROR Foo
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.stderr
new file mode 100644
index 000000000..de57f7044
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.stderr
@@ -0,0 +1,24 @@
+error[E0277]: Foo
+ --> $DIR/on_unimplemented_simple.rs:9:15
+ |
+LL | takes_foo(());
+ | --------- ^^ Bar
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Foo` is not implemented for `()`
+ = note: Baz
+help: this trait has no implementations, consider adding one
+ --> $DIR/on_unimplemented_simple.rs:4:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
+note: required by a bound in `takes_foo`
+ --> $DIR/on_unimplemented_simple.rs:6:22
+ |
+LL | fn takes_foo(_: impl Foo) {}
+ | ^^^ required by this bound in `takes_foo`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/report_warning_on_duplicated_options.rs b/tests/ui/diagnostic_namespace/on_unimplemented/report_warning_on_duplicated_options.rs
new file mode 100644
index 000000000..a7becd2f8
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/report_warning_on_duplicated_options.rs
@@ -0,0 +1,25 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic::on_unimplemented(
+ message = "first message",
+ label = "first label",
+ note = "custom note"
+)]
+#[diagnostic::on_unimplemented(
+ message = "second message",
+ //~^WARN `message` is ignored due to previous definition of `message`
+ //~|WARN `message` is ignored due to previous definition of `message`
+ label = "second label",
+ //~^WARN `label` is ignored due to previous definition of `label`
+ //~|WARN `label` is ignored due to previous definition of `label`
+ note = "second note"
+)]
+trait Foo {}
+
+
+fn takes_foo(_: impl Foo) {}
+
+fn main() {
+ takes_foo(());
+ //~^ERROR first message
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/report_warning_on_duplicated_options.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/report_warning_on_duplicated_options.stderr
new file mode 100644
index 000000000..d30754dcf
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/report_warning_on_duplicated_options.stderr
@@ -0,0 +1,67 @@
+warning: `message` is ignored due to previous definition of `message`
+ --> $DIR/report_warning_on_duplicated_options.rs:9:5
+ |
+LL | message = "first message",
+ | ------------------------- `message` is first declared here
+...
+LL | message = "second message",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `message` is already declared here
+ |
+ = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
+
+warning: `label` is ignored due to previous definition of `label`
+ --> $DIR/report_warning_on_duplicated_options.rs:12:5
+ |
+LL | label = "first label",
+ | --------------------- `label` is first declared here
+...
+LL | label = "second label",
+ | ^^^^^^^^^^^^^^^^^^^^^^ `label` is already declared here
+
+warning: `message` is ignored due to previous definition of `message`
+ --> $DIR/report_warning_on_duplicated_options.rs:9:5
+ |
+LL | message = "first message",
+ | ------------------------- `message` is first declared here
+...
+LL | message = "second message",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `message` is already declared here
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: `label` is ignored due to previous definition of `label`
+ --> $DIR/report_warning_on_duplicated_options.rs:12:5
+ |
+LL | label = "first label",
+ | --------------------- `label` is first declared here
+...
+LL | label = "second label",
+ | ^^^^^^^^^^^^^^^^^^^^^^ `label` is already declared here
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: first message
+ --> $DIR/report_warning_on_duplicated_options.rs:23:15
+ |
+LL | takes_foo(());
+ | --------- ^^ first label
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Foo` is not implemented for `()`
+ = note: custom note
+ = note: second note
+help: this trait has no implementations, consider adding one
+ --> $DIR/report_warning_on_duplicated_options.rs:17:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
+note: required by a bound in `takes_foo`
+ --> $DIR/report_warning_on_duplicated_options.rs:20:22
+ |
+LL | fn takes_foo(_: impl Foo) {}
+ | ^^^ required by this bound in `takes_foo`
+
+error: aborting due to 1 previous error; 4 warnings emitted
+
+For more information about this error, try `rustc --explain E0277`.