diff options
| author | bors <bors@rust-lang.org> | 2022-03-04 00:27:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-03-04 00:27:23 +0000 |
| commit | 6d7684101a51f1c375ec84aef5d2fbdeb214bbc2 (patch) | |
| tree | d86722eb5dda8ae7ef9980dd4a19deebb9f37cf4 /src/test/rustdoc-json | |
| parent | 40d3040ae19b8c43c0027bc6d3e9805e5ee5e0ee (diff) | |
| parent | 0e57a16c88cbb042bf4d19934e0ccdd3838645ec (diff) | |
| download | rust-6d7684101a51f1c375ec84aef5d2fbdeb214bbc2.tar.gz rust-6d7684101a51f1c375ec84aef5d2fbdeb214bbc2.zip | |
Auto merge of #94009 - compiler-errors:gat-rustdoc, r=GuillaumeGomez
Support GATs in Rustdoc Implements: 1. Rendering GATs in trait definitions and impl blocks 2. Rendering GATs in types (e.g. in the return type of a function) Fixes #92341 This is my first rustdoc PR, so I have absolutely no idea how to produce tests for this. Advice from the rustdoc team would be wonderful! I tested locally and things looked correct: 
Diffstat (limited to 'src/test/rustdoc-json')
| -rw-r--r-- | src/test/rustdoc-json/generic-associated-types/gats.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/test/rustdoc-json/generic-associated-types/gats.rs b/src/test/rustdoc-json/generic-associated-types/gats.rs new file mode 100644 index 00000000000..7adcd712ba6 --- /dev/null +++ b/src/test/rustdoc-json/generic-associated-types/gats.rs @@ -0,0 +1,42 @@ +// ignore-tidy-linelength + +#![no_core] +#![feature(generic_associated_types, lang_items, no_core)] + +#[lang = "sized"] +pub trait Sized {} + +pub trait Display {} + +// @has gats.json +pub trait LendingIterator { + // @count - "$.index[*][?(@.name=='LendingItem')].inner.generics.params[*]" 1 + // @is - "$.index[*][?(@.name=='LendingItem')].inner.generics.params[*].name" \"\'a\" + // @count - "$.index[*][?(@.name=='LendingItem')].inner.generics.where_predicates[*]" 1 + // @is - "$.index[*][?(@.name=='LendingItem')].inner.generics.where_predicates[*].bound_predicate.ty.inner" \"Self\" + // @is - "$.index[*][?(@.name=='LendingItem')].inner.generics.where_predicates[*].bound_predicate.bounds[*].outlives" \"\'a\" + // @count - "$.index[*][?(@.name=='LendingItem')].inner.bounds[*]" 1 + type LendingItem<'a>: Display where Self: 'a; + + // @is - "$.index[*][?(@.name=='lending_next')].inner.decl.output.kind" \"qualified_path\" + // @count - "$.index[*][?(@.name=='lending_next')].inner.decl.output.inner.args.angle_bracketed.args[*]" 1 + // @count - "$.index[*][?(@.name=='lending_next')].inner.decl.output.inner.args.angle_bracketed.bindings[*]" 0 + // @is - "$.index[*][?(@.name=='lending_next')].inner.decl.output.inner.self_type.inner" \"Self\" + // @is - "$.index[*][?(@.name=='lending_next')].inner.decl.output.inner.name" \"LendingItem\" + fn lending_next<'a>(&'a self) -> Self::LendingItem<'a>; +} + +// @has gats.json +pub trait Iterator { + // @count - "$.index[*][?(@.name=='Item')].inner.generics.params[*]" 0 + // @count - "$.index[*][?(@.name=='Item')].inner.generics.where_predicates[*]" 0 + // @count - "$.index[*][?(@.name=='Item')].inner.bounds[*]" 1 + type Item: Display; + + // @is - "$.index[*][?(@.name=='next')].inner.decl.output.kind" \"qualified_path\" + // @count - "$.index[*][?(@.name=='next')].inner.decl.output.inner.args.angle_bracketed.args[*]" 0 + // @count - "$.index[*][?(@.name=='next')].inner.decl.output.inner.args.angle_bracketed.bindings[*]" 0 + // @is - "$.index[*][?(@.name=='next')].inner.decl.output.inner.self_type.inner" \"Self\" + // @is - "$.index[*][?(@.name=='next')].inner.decl.output.inner.name" \"Item\" + fn next<'a>(&'a self) -> Self::Item; +} |
