about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2023-12-23 11:43:49 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2023-12-23 19:00:17 +0100
commit431ac40a93e9d8d2215d6bcb956c7b429059c728 (patch)
tree7260f0f70ff8392d3504de994c82b5e37049b5af
parentc29f763153ac89e7930c6d50f5ab4656318b30d4 (diff)
downloadrust-431ac40a93e9d8d2215d6bcb956c7b429059c728.tar.gz
rust-431ac40a93e9d8d2215d6bcb956c7b429059c728.zip
Add regression test for `is_object_safe` field on traits
-rw-r--r--tests/rustdoc-json/traits/is_object_safe.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/rustdoc-json/traits/is_object_safe.rs b/tests/rustdoc-json/traits/is_object_safe.rs
new file mode 100644
index 00000000000..131c5fc57a5
--- /dev/null
+++ b/tests/rustdoc-json/traits/is_object_safe.rs
@@ -0,0 +1,19 @@
+#![no_std]
+
+// @has "$.index[*][?(@.name=='FooUnsafe')]"
+// @is "$.index[*][?(@.name=='FooUnsafe')].inner.trait.is_object_safe" false
+pub trait FooUnsafe {
+    fn foo() -> Self;
+}
+
+// @has "$.index[*][?(@.name=='BarUnsafe')]"
+// @is "$.index[*][?(@.name=='BarUnsafe')].inner.trait.is_object_safe" false
+pub trait BarUnsafe<T> {
+    fn foo(i: T);
+}
+
+// @has "$.index[*][?(@.name=='FooSafe')]"
+// @is "$.index[*][?(@.name=='FooSafe')].inner.trait.is_object_safe" true
+pub trait FooSafe {
+    fn foo(&self);
+}