about summary refs log tree commit diff
path: root/tests/ui/unpretty
diff options
context:
space:
mode:
authorPredrag Gruevski <obi1kenobi82@gmail.com>2025-03-04 22:03:28 +0000
committerPredrag Gruevski <obi1kenobi82@gmail.com>2025-03-05 01:51:07 +0000
commit55f8d3f628e674d6874c96c9da425db406f15d09 (patch)
treeb8b9fe2b15b261be560d04ac8348bb9010707435 /tests/ui/unpretty
parentf9e0239a7bc813b4aceffc7f069f4797cde3175c (diff)
downloadrust-55f8d3f628e674d6874c96c9da425db406f15d09.tar.gz
rust-55f8d3f628e674d6874c96c9da425db406f15d09.zip
Pretty-print `#[deprecated]` attribute in HIR.
Diffstat (limited to 'tests/ui/unpretty')
-rw-r--r--tests/ui/unpretty/deprecated-attr.rs17
-rw-r--r--tests/ui/unpretty/deprecated-attr.stdout21
-rw-r--r--tests/ui/unpretty/diagnostic-attr.rs13
-rw-r--r--tests/ui/unpretty/diagnostic-attr.stdout16
4 files changed, 67 insertions, 0 deletions
diff --git a/tests/ui/unpretty/deprecated-attr.rs b/tests/ui/unpretty/deprecated-attr.rs
new file mode 100644
index 00000000000..dda362a595e
--- /dev/null
+++ b/tests/ui/unpretty/deprecated-attr.rs
@@ -0,0 +1,17 @@
+//@ compile-flags: -Zunpretty=hir
+//@ check-pass
+
+#[deprecated]
+pub struct PlainDeprecated;
+
+#[deprecated = "here's why this is deprecated"]
+pub struct DirectNote;
+
+#[deprecated(note = "here's why this is deprecated")]
+pub struct ExplicitNote;
+
+#[deprecated(since = "1.2.3", note = "here's why this is deprecated")]
+pub struct SinceAndNote;
+
+#[deprecated(note = "here's why this is deprecated", since = "1.2.3")]
+pub struct FlippedOrder;
diff --git a/tests/ui/unpretty/deprecated-attr.stdout b/tests/ui/unpretty/deprecated-attr.stdout
new file mode 100644
index 00000000000..60dbac1072b
--- /dev/null
+++ b/tests/ui/unpretty/deprecated-attr.stdout
@@ -0,0 +1,21 @@
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+#[macro_use]
+extern crate std;
+//@ compile-flags: -Zunpretty=hir
+//@ check-pass
+
+#[deprecated]
+struct PlainDeprecated;
+
+#[deprecated = "here's why this is deprecated"]
+struct DirectNote;
+
+#[deprecated = "here's why this is deprecated"]
+struct ExplicitNote;
+
+#[deprecated(since = "1.2.3", note = "here's why this is deprecated"]
+struct SinceAndNote;
+
+#[deprecated(since = "1.2.3", note = "here's why this is deprecated"]
+struct FlippedOrder;
diff --git a/tests/ui/unpretty/diagnostic-attr.rs b/tests/ui/unpretty/diagnostic-attr.rs
new file mode 100644
index 00000000000..27f5b693e69
--- /dev/null
+++ b/tests/ui/unpretty/diagnostic-attr.rs
@@ -0,0 +1,13 @@
+//@ compile-flags: -Zunpretty=hir
+//@ check-pass
+
+#[diagnostic::on_unimplemented(
+    message = "My Message for `ImportantTrait<{A}>` implemented for `{Self}`",
+    label = "My Label",
+    note = "Note 1",
+    note = "Note 2"
+)]
+pub trait ImportantTrait<A> {}
+
+#[diagnostic::do_not_recommend]
+impl<T> ImportantTrait<T> for T where T: Clone {}
diff --git a/tests/ui/unpretty/diagnostic-attr.stdout b/tests/ui/unpretty/diagnostic-attr.stdout
new file mode 100644
index 00000000000..e8696d04d38
--- /dev/null
+++ b/tests/ui/unpretty/diagnostic-attr.stdout
@@ -0,0 +1,16 @@
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+#[macro_use]
+extern crate std;
+//@ compile-flags: -Zunpretty=hir
+//@ check-pass
+
+#[diagnostic::on_unimplemented(message =
+"My Message for `ImportantTrait<{A}>` implemented for `{Self}`", label =
+"My Label", note = "Note 1", note = "Note 2")]
+trait ImportantTrait<A> { }
+
+#[diagnostic::do_not_recommend]
+impl <T> ImportantTrait<T> for T where T: Clone
+    {#![diagnostic::do_not_recommend]
+}