about summary refs log tree commit diff
path: root/tests/ui/deprecation/suggestion.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/deprecation/suggestion.rs')
-rw-r--r--tests/ui/deprecation/suggestion.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/ui/deprecation/suggestion.rs b/tests/ui/deprecation/suggestion.rs
new file mode 100644
index 00000000000..9dc2eaf2555
--- /dev/null
+++ b/tests/ui/deprecation/suggestion.rs
@@ -0,0 +1,43 @@
+// run-rustfix
+
+#![feature(staged_api)]
+#![feature(deprecated_suggestion)]
+
+#![stable(since = "1.0.0", feature = "test")]
+
+#![deny(deprecated)]
+#![allow(dead_code)]
+
+struct Foo;
+
+impl Foo {
+    #[deprecated(
+        since = "1.0.0",
+        note = "replaced by `replacement`",
+        suggestion = "replacement",
+    )]
+    #[stable(since = "1.0.0", feature = "test")]
+    fn deprecated(&self) {}
+
+    fn replacement(&self) {}
+}
+
+mod bar {
+    #[deprecated(
+    since = "1.0.0",
+    note = "replaced by `replacement`",
+    suggestion = "replacement",
+    )]
+    #[stable(since = "1.0.0", feature = "test")]
+    pub fn deprecated() {}
+
+    pub fn replacement() {}
+}
+
+fn main() {
+    let foo = Foo;
+
+    foo.deprecated(); //~ ERROR use of deprecated
+
+    bar::deprecated(); //~ ERROR use of deprecated
+}