summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-06-21 10:53:25 +0200
committerGitHub <noreply@github.com>2025-06-21 10:53:25 +0200
commit5f727066d83ec5c54e11933833228a5e210ade1b (patch)
tree82ccef70daa796cb1c8034b39fc0075864221255 /tests
parentdf4ad9e28b9fb973e244ebc65a8167a261b8f45e (diff)
parent7fa8901cd090093a57723d3f196c27db3b98ad94 (diff)
downloadrust-5f727066d83ec5c54e11933833228a5e210ade1b.tar.gz
rust-5f727066d83ec5c54e11933833228a5e210ade1b.zip
Rollup merge of #142502 - nnethercote:rustdoc-json-GenericArgs, r=aDotInTheVoid
rustdoc_json: improve handling of generic args

This PR fixes some inconsistencies and inefficiencies in how generic args are handled by rustdoc-json-types.

r? `@aDotInTheVoid`
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-json/generic-args.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/rustdoc-json/generic-args.rs b/tests/rustdoc-json/generic-args.rs
new file mode 100644
index 00000000000..0f588820da7
--- /dev/null
+++ b/tests/rustdoc-json/generic-args.rs
@@ -0,0 +1,20 @@
+pub struct MyStruct(u32);
+
+pub trait MyTrait {
+    type MyType;
+    fn my_fn(&self);
+}
+
+impl MyTrait for MyStruct {
+    type MyType = u32;
+    fn my_fn(&self) {}
+}
+
+//@ is "$.index[?(@.name=='my_fn1')].inner.function.sig.inputs[0][1].qualified_path.args" null
+//@ is "$.index[?(@.name=='my_fn1')].inner.function.sig.inputs[0][1].qualified_path.self_type.resolved_path.args" null
+pub fn my_fn1(_: <MyStruct as MyTrait>::MyType) {}
+
+//@ is "$.index[?(@.name=='my_fn2')].inner.function.sig.inputs[0][1].dyn_trait.traits[0].trait.args.angle_bracketed.constraints[0].args" null
+pub fn my_fn2(_: IntoIterator<Item = MyStruct, IntoIter = impl Clone>) {}
+
+fn main() {}