) { loop {} }
diff --git a/src/test/rustdoc-js/generics.js b/src/test/rustdoc-js/generics.js
new file mode 100644
index 0000000000000..49a80ae2360f5
--- /dev/null
+++ b/src/test/rustdoc-js/generics.js
@@ -0,0 +1,44 @@
+// exact-check
+
+const QUERY = [
+ '"R"',
+ '"P"',
+ 'P',
+ '"ExtraCreditStructMulti"',
+];
+
+const EXPECTED = [
+ {
+ 'returned': [
+ { 'path': 'generics', 'name': 'alef' },
+ ],
+ 'in_args': [
+ { 'path': 'generics', 'name': 'alpha' },
+ ],
+ },
+ {
+ 'others': [
+ { 'path': 'generics', 'name': 'P' },
+ ],
+ 'returned': [
+ { 'path': 'generics', 'name': 'alef' },
+ ],
+ 'in_args': [
+ { 'path': 'generics', 'name': 'alpha' },
+ ],
+ },
+ {
+ 'returned': [
+ { 'path': 'generics', 'name': 'alef' },
+ ],
+ 'in_args': [
+ { 'path': 'generics', 'name': 'alpha' },
+ ],
+ },
+ {
+ 'in_args': [
+ { 'path': 'generics', 'name': 'extracreditlabhomework' },
+ ],
+ 'returned': [],
+ },
+];
diff --git a/src/test/rustdoc-js/generics.rs b/src/test/rustdoc-js/generics.rs
new file mode 100644
index 0000000000000..a0dc086e9f9cf
--- /dev/null
+++ b/src/test/rustdoc-js/generics.rs
@@ -0,0 +1,21 @@
+pub struct P;
+pub struct Q;
+pub struct R(T);
+
+// returns test
+pub fn alef() -> R { loop {} }
+pub fn bet() -> R { loop {} }
+
+// in_args test
+pub fn alpha(_x: R) { loop {} }
+pub fn beta(_x: R) { loop {} }
+
+// test case with multiple appearances of the same type
+pub struct ExtraCreditStructMulti { t: T, u: U }
+pub struct ExtraCreditInnerMulti {}
+pub fn extracreditlabhomework(
+ _param: ExtraCreditStructMulti
+) { loop {} }
+pub fn redherringmatchforextracredit(
+ _param: ExtraCreditStructMulti
+) { loop {} }