diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-04-30 16:25:46 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-30 16:25:46 +0200 |
| commit | 5dec8dff7ba1ec2ae18d9e903c24172bb189ba7a (patch) | |
| tree | b1e425b33a4df2872c8d6774e3fe62b5b3d94ccb /tests/rustdoc | |
| parent | b64d4c2f26f9cf781be4d0d2e378f5a475aa66d6 (diff) | |
| parent | b1d08275a9914b59bbad3cf5f80073b8365e9e67 (diff) | |
| download | rust-5dec8dff7ba1ec2ae18d9e903c24172bb189ba7a.tar.gz rust-5dec8dff7ba1ec2ae18d9e903c24172bb189ba7a.zip | |
Rollup merge of #110631 - notriddle:notriddle/impl-trait-cycle, r=GuillaumeGomez
rustdoc: catch and don't blow up on impl Trait cycles
Fixes #110629
An odd feature of Rust is that `Foo` is invalid, but `Bar` is okay:
type Foo<'a, 'b> = Box<dyn PartialEq<Foo<'a, 'b>>>;
type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>>;
To get it right, track every time rustdoc descends into a type alias, so if it shows up twice, it can be write the path instead of infinitely expanding it.
Diffstat (limited to 'tests/rustdoc')
| -rw-r--r-- | tests/rustdoc/issue-110629-private-type-cycle.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/rustdoc/issue-110629-private-type-cycle.rs b/tests/rustdoc/issue-110629-private-type-cycle.rs new file mode 100644 index 00000000000..a4efbb098f7 --- /dev/null +++ b/tests/rustdoc/issue-110629-private-type-cycle.rs @@ -0,0 +1,19 @@ +// compile-flags: --document-private-items + +#![feature(type_alias_impl_trait)] + +type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>> + std::fmt::Debug; + +// @has issue_110629_private_type_cycle/type.Bar.html +// @has - '//pre[@class="rust item-decl"]' \ +// "pub(crate) type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>> + Debug;" + +fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> { + i +} + +fn main() { + let meh = 42; + let muh = 42; + assert_eq!(bar(&meh), bar(&muh)); +} |
