Closed vOROn200 closed 5 years ago
where am I wrong? why do i get an error
use generator::Gn; pub struct TestStruct<'a> { pub name: Cow<'a, str>, pub value: i32 } impl<'a> TestStruct<'a> { pub fn new() -> TestStruct<'a> { TestStruct { name: Cow::Owned("test".to_string()), value: 0 } } } pub fn test_1gen<'a> () -> impl Iterator<Item =TestStruct<'a>> { Gn::new_scoped(move |mut s| { for _i in (0..10).step_by(2) { let py = TestStruct::new(); s.yield_(py); } generator::done!(); }) } pub fn test_2gen<'a>() -> impl Iterator<Item = TestStruct<'a>> { let iter_test = test_1gen(); Gn::new_scoped(move |mut s| { for i in iter_test { s.yield_(i); } generator::done!(); }) } fn main() { for i in test_2gen() { println!("{}", i.name); } }
munmap_chunk(): invalid pointer Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
Rust 1.33-1.35 stable/nightly linux-gnu - x86_64
Thanks! This is apparently a bug. The root cause is that the done macro returns a dummy value and we should not run the drop on it. The fix is easy, just forget the dummy value.
just release 0.6.13 for the fix
where am I wrong? why do i get an error
munmap_chunk(): invalid pointer Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
Rust 1.33-1.35 stable/nightly linux-gnu - x86_64