diff options
| author | Ulrik Sverdrup <root@localhost> | 2015-05-25 15:06:38 +0200 |
|---|---|---|
| committer | Ulrik Sverdrup <root@localhost> | 2015-05-25 19:06:58 +0200 |
| commit | d1cd689b4867e915e42264175d54c45f22180206 (patch) | |
| tree | 28e75952e0cbe9cc042748411327705be6f3a1d5 /src/test/rustdoc | |
| parent | 093e18d18465364ef96495ab662fb4325595bead (diff) | |
| download | rust-d1cd689b4867e915e42264175d54c45f22180206.tar.gz rust-d1cd689b4867e915e42264175d54c45f22180206.zip | |
rustdoc: Fix associated types in signatures
Functions such as `fn foo<I: Iterator>(x: I::Item)` would not render correctly and displayed `I` instead of `I::Item`. Same thing with `I::Item` appearing in where bounds. This fixes the bug by using paths for generics. Fixes #24417
Diffstat (limited to 'src/test/rustdoc')
| -rw-r--r-- | src/test/rustdoc/assoc-types.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/rustdoc/assoc-types.rs b/src/test/rustdoc/assoc-types.rs index 20076a76494..d5047ade062 100644 --- a/src/test/rustdoc/assoc-types.rs +++ b/src/test/rustdoc/assoc-types.rs @@ -18,3 +18,25 @@ pub trait Index<I: ?Sized> { // "fn index<'a>(&'a self, index: I) -> &'a Self::Output" fn index<'a>(&'a self, index: I) -> &'a Self::Output; } + +// @has assoc_types/fn.use_output.html +// @has - '//*[@class="rust fn"]' '-> &T::Output' +pub fn use_output<T: Index<usize>>(obj: &T, index: usize) -> &T::Output { + obj.index(index) +} + +pub trait Feed { + type Input; +} + +// @has assoc_types/fn.use_input.html +// @has - '//*[@class="rust fn"]' 'T::Input' +pub fn use_input<T: Feed>(_feed: &T, _element: T::Input) { } + +// @has assoc_types/fn.cmp_input.html +// @has - '//*[@class="rust fn"]' 'where T::Input: PartialEq<U::Input>' +pub fn cmp_input<T: Feed, U: Feed>(a: &T::Input, b: &U::Input) -> bool + where T::Input: PartialEq<U::Input> +{ + a == b +} |
