@@ -1769,9 +1769,13 @@ fn get_real_types(
17691769 generics : & Generics ,
17701770 arg : & Type ,
17711771 cx : & DocContext < ' _ > ,
1772+ recurse : i32 ,
17721773) -> FxHashSet < Type > {
17731774 let arg_s = arg. to_string ( ) ;
17741775 let mut res = FxHashSet :: default ( ) ;
1776+ if recurse >= 10 { // FIXME: remove this whole recurse thing when the recursion bug is fixed
1777+ return res;
1778+ }
17751779 if arg. is_full_generic ( ) {
17761780 if let Some ( where_pred) = generics. where_predicates . iter ( ) . find ( |g| {
17771781 match g {
@@ -1788,7 +1792,7 @@ fn get_real_types(
17881792 continue
17891793 }
17901794 if let Some ( ty) = x. get_type ( cx) {
1791- let adds = get_real_types ( generics, & ty, cx) ;
1795+ let adds = get_real_types ( generics, & ty, cx, recurse + 1 ) ;
17921796 if !adds. is_empty ( ) {
17931797 res. extend ( adds) ;
17941798 } else if !ty. is_full_generic ( ) {
@@ -1806,7 +1810,7 @@ fn get_real_types(
18061810 } ) {
18071811 for bound in bound. get_bounds ( ) . unwrap_or_else ( || & [ ] ) {
18081812 if let Some ( ty) = bound. get_trait_type ( ) {
1809- let adds = get_real_types ( generics, & ty, cx) ;
1813+ let adds = get_real_types ( generics, & ty, cx, recurse + 1 ) ;
18101814 if !adds. is_empty ( ) {
18111815 res. extend ( adds) ;
18121816 } else if !ty. is_full_generic ( ) {
@@ -1820,7 +1824,7 @@ fn get_real_types(
18201824 if let Some ( gens) = arg. generics ( ) {
18211825 for gen in gens. iter ( ) {
18221826 if gen. is_full_generic ( ) {
1823- let adds = get_real_types ( generics, gen, cx) ;
1827+ let adds = get_real_types ( generics, gen, cx, recurse + 1 ) ;
18241828 if !adds. is_empty ( ) {
18251829 res. extend ( adds) ;
18261830 }
@@ -1847,7 +1851,7 @@ pub fn get_all_types(
18471851 if arg. type_ . is_self_type ( ) {
18481852 continue ;
18491853 }
1850- let args = get_real_types ( generics, & arg. type_ , cx) ;
1854+ let args = get_real_types ( generics, & arg. type_ , cx, 0 ) ;
18511855 if !args. is_empty ( ) {
18521856 all_types. extend ( args) ;
18531857 } else {
@@ -1857,7 +1861,7 @@ pub fn get_all_types(
18571861
18581862 let ret_types = match decl. output {
18591863 FunctionRetTy :: Return ( ref return_type) => {
1860- let mut ret = get_real_types ( generics, & return_type, cx) ;
1864+ let mut ret = get_real_types ( generics, & return_type, cx, 0 ) ;
18611865 if ret. is_empty ( ) {
18621866 ret. insert ( return_type. clone ( ) ) ;
18631867 }
0 commit comments