From 244fddddeaace9af894dcc3c88ee7ee7f160c9fa Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Fri, 28 Dec 2018 20:40:35 +0000 Subject: [PATCH] Avoid recursive type error introduced in rust-lang/rust#56074 --- src/metadata/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/metadata/mod.rs b/src/metadata/mod.rs index 61c9071..f294599 100644 --- a/src/metadata/mod.rs +++ b/src/metadata/mod.rs @@ -153,7 +153,10 @@ impl MetaValue { MetaValue::Str(ref s) => { yield s; }, MetaValue::Seq(ref mvs) => { for mv in mvs { - for i in Box::new(mv.iter_over(mis)) { + // We cannot hold a value of our return type across a yield as it makes the + // generator type recursive. Erasing the type avoids this issue. + let values: Box> = Box::new(mv.iter_over(mis)); + for i in values { yield i; } } @@ -172,7 +175,8 @@ impl MetaValue { match mis { MappingIterScheme::Vals | MappingIterScheme::Both => { - for s in Box::new(mv.iter_over(mis)) { + let values: Box> = Box::new(mv.iter_over(mis)); + for s in values { yield s; } },