From 53034ea8c9a2cc88c063fc31ee23b9c279201ee3 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 23 Dec 2023 11:43:49 +0100 Subject: [PATCH] Add regression test for `is_object_safe` field on traits --- tests/rustdoc-json/traits/is_object_safe.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/rustdoc-json/traits/is_object_safe.rs 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 0000000000000..5b1a35748cf46 --- /dev/null +++ b/tests/rustdoc-json/traits/is_object_safe.rs @@ -0,0 +1,19 @@ +#![no_std] + +// @has "$.index[*][?(@.name=='FooUnsafe')]" +// @has "$.index[*][?(@.name=='FooUnsafe')].inner.trait.is_object_safe" false +pub trait FooUnsafe { + fn foo() -> Self; +} + +// @has "$.index[*][?(@.name=='BarUnsafe')]" +// @has "$.index[*][?(@.name=='BarUnsafe')].inner.trait.is_object_safe" false +pub trait BarUnsafe { + fn foo(i: T); +} + +// @has "$.index[*][?(@.name=='FooSafe')]" +// @has "$.index[*][?(@.name=='FooSafe')].inner.trait.is_object_safe" true +pub trait FooSafe { + fn foo(&self); +}