▾ modified src/lower.rs +5 -2 Viewed
@@ -1425,7 +1425,10 @@ impl Lowerer { 1425 1425 // outermost node. 1426 1426 use syn ::Type ; 1427 1427 let mut nested = t . clone ( ) ; 1428 - let rec = | me : & Self , e : & syn ::Type | me . expand ( e , depth + 1 ) ; 1428 + // `depth` counts alias substitutions, not descent into the type: a 1429 + // deeply nested type is not a cycle, and charging it against the same 1430 + // budget made `Vec<HashMap<String, Vec<..>>>` look like one. 1431 + let rec = | me : & Self , e : & syn ::Type | me . expand ( e , depth ) ; 1429 1432 match & mut nested { 1430 1433 Type ::Reference ( r ) = > { 1431 1434 * r . elem = rec ( self , & r . elem ) ? ; @@ -1482,7 +1485,7 @@ impl Lowerer { 1482 1485 if let syn ::PathArguments ::AngleBracketed ( a ) = & mut seg . arguments { 1483 1486 for g in a . args . iter_mut ( ) { 1484 1487 if let GenericArgument ::Type ( at ) = g { 1485 - * at = self . expand ( at , depth + 1 ) ? ; 1488 + * at = self . expand ( at , depth ) ? ; 1486 1489 } 1487 1490 } 1488 1491 }
@@ -1425,7 +1425,10 @@ impl Lowerer { 1425 // outermost node. 1425 // outermost node. 1426 use syn ::Type ; 1426 use syn ::Type ; 1427 let mut nested = t . clone ( ) ; 1427 let mut nested = t . clone ( ) ; 1428 - let rec = | me : & Self , e : & syn ::Type | me . expand ( e , depth + 1 ) ; 1428 + // `depth` counts alias substitutions, not descent into the type: a 1429 + // deeply nested type is not a cycle, and charging it against the same 1430 + // budget made `Vec<HashMap<String, Vec<..>>>` look like one. 1431 + let rec = | me : & Self , e : & syn ::Type | me . expand ( e , depth ) ; 1429 match & mut nested { 1432 match & mut nested { 1430 Type ::Reference ( r ) = > { 1433 Type ::Reference ( r ) = > { 1431 * r . elem = rec ( self , & r . elem ) ? ; 1434 * r . elem = rec ( self , & r . elem ) ? ; @@ -1482,7 +1485,7 @@ impl Lowerer { 1482 if let syn ::PathArguments ::AngleBracketed ( a ) = & mut seg . arguments { 1485 if let syn ::PathArguments ::AngleBracketed ( a ) = & mut seg . arguments { 1483 for g in a . args . iter_mut ( ) { 1486 for g in a . args . iter_mut ( ) { 1484 if let GenericArgument ::Type ( at ) = g { 1487 if let GenericArgument ::Type ( at ) = g { 1485 - * at = self . expand ( at , depth + 1 ) ? ; 1488 + * at = self . expand ( at , depth ) ? ; 1486 } 1489 } 1487 } 1490 } 1488 } 1491 }