@@ -1766,9 +1766,13 @@ fn get_real_types(
17661766 generics : & Generics ,
17671767 arg : & Type ,
17681768 cx : & DocContext < ' _ > ,
1769+ recurse : i32 ,
17691770) -> FxHashSet < Type > {
17701771 let arg_s = arg. to_string ( ) ;
17711772 let mut res = FxHashSet :: default ( ) ;
1773+ if recurse >= 10 { // FIXME: remove this whole recurse thing when the recursion bug is fixed
1774+ return res;
1775+ }
17721776 if arg. is_full_generic ( ) {
17731777 if let Some ( where_pred) = generics. where_predicates . iter ( ) . find ( |g| {
17741778 match g {
@@ -1785,7 +1789,7 @@ fn get_real_types(
17851789 continue
17861790 }
17871791 if let Some ( ty) = x. get_type ( cx) {
1788- let adds = get_real_types ( generics, & ty, cx) ;
1792+ let adds = get_real_types ( generics, & ty, cx, recurse + 1 ) ;
17891793 if !adds. is_empty ( ) {
17901794 res. extend ( adds) ;
17911795 } else if !ty. is_full_generic ( ) {
@@ -1803,7 +1807,7 @@ fn get_real_types(
18031807 } ) {
18041808 for bound in bound. get_bounds ( ) . unwrap_or_else ( || & [ ] ) {
18051809 if let Some ( ty) = bound. get_trait_type ( ) {
1806- let adds = get_real_types ( generics, & ty, cx) ;
1810+ let adds = get_real_types ( generics, & ty, cx, recurse + 1 ) ;
18071811 if !adds. is_empty ( ) {
18081812 res. extend ( adds) ;
18091813 } else if !ty. is_full_generic ( ) {
@@ -1817,7 +1821,7 @@ fn get_real_types(
18171821 if let Some ( gens) = arg. generics ( ) {
18181822 for gen in gens. iter ( ) {
18191823 if gen. is_full_generic ( ) {
1820- let adds = get_real_types ( generics, gen, cx) ;
1824+ let adds = get_real_types ( generics, gen, cx, recurse + 1 ) ;
18211825 if !adds. is_empty ( ) {
18221826 res. extend ( adds) ;
18231827 }
@@ -1844,7 +1848,7 @@ pub fn get_all_types(
18441848 if arg. type_ . is_self_type ( ) {
18451849 continue ;
18461850 }
1847- let args = get_real_types ( generics, & arg. type_ , cx) ;
1851+ let args = get_real_types ( generics, & arg. type_ , cx, 0 ) ;
18481852 if !args. is_empty ( ) {
18491853 all_types. extend ( args) ;
18501854 } else {
@@ -1854,7 +1858,7 @@ pub fn get_all_types(
18541858
18551859 let ret_types = match decl. output {
18561860 FunctionRetTy :: Return ( ref return_type) => {
1857- let mut ret = get_real_types ( generics, & return_type, cx) ;
1861+ let mut ret = get_real_types ( generics, & return_type, cx, 0 ) ;
18581862 if ret. is_empty ( ) {
18591863 ret. insert ( return_type. clone ( ) ) ;
18601864 }
0 commit comments