about summary refs log tree commit diff
path: root/tests/ui/deprecation/deprecation-lint-nested.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/deprecation/deprecation-lint-nested.rs')
-rw-r--r--tests/ui/deprecation/deprecation-lint-nested.rs71
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/ui/deprecation/deprecation-lint-nested.rs b/tests/ui/deprecation/deprecation-lint-nested.rs
new file mode 100644
index 00000000000..589522cdbdf
--- /dev/null
+++ b/tests/ui/deprecation/deprecation-lint-nested.rs
@@ -0,0 +1,71 @@
+#![deny(deprecated)]
+#![allow(warnings)]
+
+#[deprecated]
+fn issue_35128() {
+    format_args!("foo");
+}
+
+#[deprecated]
+fn issue_35128_minimal() {
+    static FOO: &'static str = "foo";
+    let _ = FOO;
+}
+
+#[deprecated]
+mod silent {
+    type DeprecatedType = u8;
+    struct DeprecatedStruct;
+    fn deprecated_fn() {}
+    trait DeprecatedTrait {}
+    static DEPRECATED_STATIC: u8 = 0;
+    const DEPRECATED_CONST: u8 = 1;
+
+    struct Foo(DeprecatedType);
+
+    impl DeprecatedTrait for Foo {}
+
+    impl Foo {
+        fn bar<T: DeprecatedTrait>() {
+            deprecated_fn();
+        }
+    }
+
+    fn foo() -> u8 {
+        DEPRECATED_STATIC +
+        DEPRECATED_CONST
+    }
+}
+
+#[deprecated]
+mod loud {
+    #[deprecated]
+    type DeprecatedType = u8;
+    #[deprecated]
+    struct DeprecatedStruct;
+    #[deprecated]
+    fn deprecated_fn() {}
+    #[deprecated]
+    trait DeprecatedTrait {}
+    #[deprecated]
+    static DEPRECATED_STATIC: u8 = 0;
+    #[deprecated]
+    const DEPRECATED_CONST: u8 = 1;
+
+    struct Foo(DeprecatedType); //~ ERROR use of deprecated type alias
+
+    impl DeprecatedTrait for Foo {} //~ ERROR use of deprecated trait
+
+    impl Foo {
+        fn bar<T: DeprecatedTrait>() { //~ ERROR use of deprecated trait
+            deprecated_fn(); //~ ERROR use of deprecated function
+        }
+    }
+
+    fn foo() -> u8 {
+        DEPRECATED_STATIC + //~ ERROR use of deprecated static
+        DEPRECATED_CONST //~ ERROR use of deprecated const
+    }
+}
+
+fn main() {}