summaryrefslogtreecommitdiffstats
path: root/tests/ui/diagnostic_namespace
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:36 +0000
commite02c5b5930c2c9ba3e5423fe12e2ef0155017297 (patch)
treefd60ebbbb5299e16e5fca8c773ddb74f764760db /tests/ui/diagnostic_namespace
parentAdding debian version 1.73.0+dfsg1-1. (diff)
downloadrustc-e02c5b5930c2c9ba3e5423fe12e2ef0155017297.tar.xz
rustc-e02c5b5930c2c9ba3e5423fe12e2ef0155017297.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/diagnostic_namespace')
-rw-r--r--tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs4
-rw-r--r--tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr6
-rw-r--r--tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr2
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs37
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr110
-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/on_unimplemented_simple.rs11
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.stderr24
9 files changed, 207 insertions, 6 deletions
diff --git a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs
index a686ed9c8..b08e29162 100644
--- a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs
+++ b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs
@@ -1,12 +1,12 @@
#[diagnostic::non_existing_attribute]
//~^ERROR `#[diagnostic]` attribute name space is experimental [E0658]
-//~|WARNING unknown diagnostic attribute [unknown_diagnostic_attributes]
+//~|WARNING unknown diagnostic attribute [unknown_or_malformed_diagnostic_attributes]
pub trait Bar {
}
#[diagnostic::non_existing_attribute(with_option = "foo")]
//~^ERROR `#[diagnostic]` attribute name space is experimental [E0658]
-//~|WARNING unknown diagnostic attribute [unknown_diagnostic_attributes]
+//~|WARNING unknown diagnostic attribute [unknown_or_malformed_diagnostic_attributes]
struct Foo;
fn main() {
diff --git a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr
index 45c95cbb3..017d00e2c 100644
--- a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr
+++ b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr
@@ -4,7 +4,7 @@ error[E0658]: `#[diagnostic]` attribute name space is experimental
LL | #[diagnostic::non_existing_attribute]
| ^^^^^^^^^^
|
- = note: see issue #94785 <https://github.com/rust-lang/rust/issues/94785> for more information
+ = 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[E0658]: `#[diagnostic]` attribute name space is experimental
@@ -13,7 +13,7 @@ error[E0658]: `#[diagnostic]` attribute name space is experimental
LL | #[diagnostic::non_existing_attribute(with_option = "foo")]
| ^^^^^^^^^^
|
- = note: see issue #94785 <https://github.com/rust-lang/rust/issues/94785> for more information
+ = 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
warning: unknown diagnostic attribute
@@ -22,7 +22,7 @@ warning: unknown diagnostic attribute
LL | #[diagnostic::non_existing_attribute]
| ^^^^^^^^^^^^^^^^^^^^^^
|
- = note: `#[warn(unknown_diagnostic_attributes)]` on by default
+ = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
warning: unknown diagnostic attribute
--> $DIR/feature-gate-diagnostic_namespace.rs:7:15
diff --git a/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr
index 4f9b7ba2b..753077b36 100644
--- a/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr
+++ b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr
@@ -4,7 +4,7 @@ warning: unknown diagnostic attribute
LL | #[diagnostic::non_existing_attribute]
| ^^^^^^^^^^^^^^^^^^^^^^
|
- = note: `#[warn(unknown_diagnostic_attributes)]` on by default
+ = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
warning: unknown diagnostic attribute
--> $DIR/non_existing_attributes_accepted.rs:8:15
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..00fb59d14
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs
@@ -0,0 +1,37 @@
+#![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 {}
+
+fn take_foo(_: impl Foo) {}
+fn take_baz(_: impl Baz) {}
+fn take_boom(_: impl Boom) {}
+
+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
+}
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..bb1b29ef2
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr
@@ -0,0 +1,110 @@
+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")]
+ | ^^^^^^^^^^^^^^^^^^^
+
+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")]
+ | ^^^^^^^^^^^^^^^^^^^
+
+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"))]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:22:1
+ |
+LL | #[diagnostic::on_unimplemented = "boom"]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32
+ |
+LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:31: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:26: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")]
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: Boom
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:33: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:27: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"))]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: Boom
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:35: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:28:22
+ |
+LL | fn take_boom(_: impl Boom) {}
+ | ^^^^ required by this bound in `take_boom`
+
+error: aborting due to 3 previous errors; 8 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..21f02e3a7
--- /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 previous error
+
+For more information about this error, try `rustc --explain E0658`.
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..549c7caa7
--- /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 previous error
+
+For more information about this error, try `rustc --explain E0277`.