From f5cdfb47e56bc09c29f4ddca77c433a0ebf8c19a Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 26 Jan 2022 09:24:36 -0700 Subject: [PATCH] rustdoc: add test case for multiple traits and erased names https://github.com/rust-lang/rust/pull/92339#discussion_r792805289 --- src/test/rustdoc-js/generics-multi-trait.js | 32 +++++++++++++++++++++ src/test/rustdoc-js/generics-multi-trait.rs | 12 ++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/test/rustdoc-js/generics-multi-trait.js create mode 100644 src/test/rustdoc-js/generics-multi-trait.rs diff --git a/src/test/rustdoc-js/generics-multi-trait.js b/src/test/rustdoc-js/generics-multi-trait.js new file mode 100644 index 00000000000..e7fcea876c8 --- /dev/null +++ b/src/test/rustdoc-js/generics-multi-trait.js @@ -0,0 +1,32 @@ +// exact-check + +const QUERY = [ + 'Result', + 'Zzzzzzzzzzzzzzzzzz', + 'Nonononononononono', +]; + +const EXPECTED = [ + // check one of the generic items + { + 'in_args': [ + { 'path': 'generics_multi_trait', 'name': 'beta' }, + ], + 'returned': [ + { 'path': 'generics_multi_trait', 'name': 'bet' }, + ], + }, + { + 'in_args': [ + { 'path': 'generics_multi_trait', 'name': 'beta' }, + ], + 'returned': [ + { 'path': 'generics_multi_trait', 'name': 'bet' }, + ], + }, + // ignore the name of the generic itself + { + 'in_args': [], + 'returned': [], + }, +]; diff --git a/src/test/rustdoc-js/generics-multi-trait.rs b/src/test/rustdoc-js/generics-multi-trait.rs new file mode 100644 index 00000000000..e6fd06d254c --- /dev/null +++ b/src/test/rustdoc-js/generics-multi-trait.rs @@ -0,0 +1,12 @@ +pub trait SomeTrait {} +pub trait Zzzzzzzzzzzzzzzzzz {} + +pub fn bet() -> Result { + loop {} +} + +pub fn beta( + _param: Result, +) { + loop {} +}