summaryrefslogtreecommitdiffstats
path: root/tests/rust/deprecated.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rust/deprecated.rs')
-rw-r--r--tests/rust/deprecated.rs52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/rust/deprecated.rs b/tests/rust/deprecated.rs
new file mode 100644
index 0000000..3abf65a
--- /dev/null
+++ b/tests/rust/deprecated.rs
@@ -0,0 +1,52 @@
+#[no_mangle]
+#[deprecated]
+pub extern "C" fn deprecated_without_note() {}
+
+#[no_mangle]
+#[deprecated = "This is a note"]
+pub extern "C" fn deprecated_without_bracket() {}
+
+#[no_mangle]
+#[deprecated(note = "This is a note")]
+pub extern "C" fn deprecated_with_note() {}
+
+#[no_mangle]
+#[deprecated(note = "This is a note", since = "1.0.0")]
+pub extern "C" fn deprecated_with_note_and_since() {}
+
+#[no_mangle]
+#[deprecated(note = "This quote \" requires to be quoted, and this [\n] requires to be escaped")]
+pub extern "C" fn deprecated_with_note_which_requires_to_be_escaped() {}
+
+#[repr(i32)]
+#[deprecated]
+pub enum DeprecatedEnum {
+ A = 0,
+}
+
+#[repr(i32)]
+#[deprecated(note = "This is a note")]
+pub enum DeprecatedEnumWithNote {
+ B = 0,
+}
+
+#[repr(C)]
+#[deprecated]
+pub struct DeprecatedStruct {
+ pub a: i32,
+}
+
+#[repr(C)]
+#[deprecated(note = "This is a note")]
+pub struct DeprecatedStructWithNote {
+ pub a: i32,
+}
+
+#[no_mangle]
+pub extern "C" fn dummy(
+ a: DeprecatedEnum,
+ b: DeprecatedEnumWithNote,
+ c: DeprecatedStruct,
+ d: DeprecatedStructWithNote,
+) -> void {
+}