Commit 7eefe2b 1 parent e44fc6c commit 7eefe2b Copy full SHA for 7eefe2b
File tree 2 files changed +42
-7
lines changed
2 files changed +42
-7
lines changed Original file line number Diff line number Diff line change @@ -1754,16 +1754,39 @@ pub struct Generics {
1754
1754
1755
1755
impl Clean < Generics > for hir:: Generics {
1756
1756
fn clean ( & self , cx : & DocContext ) -> Generics {
1757
+ // Synthetic type-parameters are inserted after normal ones.
1758
+ // In order for normal parameters to be able to refer to synthetic ones,
1759
+ // scans them first.
1760
+ fn is_impl_trait ( param : & hir:: GenericParam ) -> bool {
1761
+ if let hir:: GenericParam :: Type ( ref tp) = param {
1762
+ tp. synthetic == Some ( hir:: SyntheticTyParamKind :: ImplTrait )
1763
+ } else {
1764
+ false
1765
+ }
1766
+ }
1767
+ let impl_trait_params = self . params
1768
+ . iter ( )
1769
+ . filter ( |p| is_impl_trait ( p) )
1770
+ . map ( |p| {
1771
+ let p = p. clean ( cx) ;
1772
+ if let GenericParamDef :: Type ( ref tp) = p {
1773
+ cx. impl_trait_bounds
1774
+ . borrow_mut ( )
1775
+ . insert ( tp. did , tp. bounds . clone ( ) ) ;
1776
+ } else {
1777
+ unreachable ! ( )
1778
+ }
1779
+ p
1780
+ } )
1781
+ . collect :: < Vec < _ > > ( ) ;
1782
+
1757
1783
let mut params = Vec :: with_capacity ( self . params . len ( ) ) ;
1758
- for p in & self . params {
1784
+ for p in self . params . iter ( ) . filter ( |p| ! is_impl_trait ( p ) ) {
1759
1785
let p = p. clean ( cx) ;
1760
- if let GenericParamDef :: Type ( ref tp) = p {
1761
- if tp. synthetic == Some ( hir:: SyntheticTyParamKind :: ImplTrait ) {
1762
- cx. impl_trait_bounds . borrow_mut ( ) . insert ( tp. did , tp. bounds . clone ( ) ) ;
1763
- }
1764
- }
1765
1786
params. push ( p) ;
1766
1787
}
1788
+ params. extend ( impl_trait_params) ;
1789
+
1767
1790
let mut g = Generics {
1768
1791
params,
1769
1792
where_predicates : self . where_clause . predicates . clean ( cx)
Original file line number Diff line number Diff line change 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- #![ feature( universal_impl_trait) ]
12
11
#![ crate_name = "foo" ]
13
12
14
13
use std:: io:: Read ;
14
+ use std:: borrow:: Borrow ;
15
15
16
16
// @has foo/fn.foo.html
17
17
// @has - //pre 'foo('
@@ -51,3 +51,15 @@ impl<T> S<T> {
51
51
// @has - 'method</a>('
52
52
// @matches - '_x: impl <a class="trait" href="[^"]+/trait\.Debug\.html"'
53
53
impl < T > Trait for S < T > { }
54
+
55
+ // @has foo/fn.much_universe.html
56
+ // @matches - 'T:.+Borrow.+impl .+trait\.Trait\.html'
57
+ // @matches - 'U:.+IntoIterator.+= impl.+Iterator\.html.+= impl.+Clone\.html'
58
+ // @matches - '_: impl .+trait\.Read\.html.+ \+ .+trait\.Clone\.html'
59
+ pub fn much_universe <
60
+ T : Borrow < impl Trait > ,
61
+ U : IntoIterator < Item = impl Iterator < Item = impl Clone > > ,
62
+ > (
63
+ _: impl Read + Clone ,
64
+ ) {
65
+ }
You can’t perform that action at this time.
0 commit comments