DEV Community

Discussion on: YARIT: Yet Another Rust Iterators Tutorial

 
dandyvica profile image
Dandy Vica

Are you sure it's not related to the first error 0658 ?

Thread Thread
 
x10an14 profile image
x10an14

I dunno, I thought the error message I had was that it ended up in an infinite recursive loop due to somehow making the iterator's next() function refer to itself.

It's unfortunately a bit too long for me to remember.

I know that I get an overflow when I try

[2020-03-12 20:24:38] 0 x10an14@x10-desktop:~/gitlab/n-dim-ttt                                                                                                                                                                                              (master=)
-> $ cargo run -- -i 4 
warning: unused import: `cmp::max`
 --> src/game_objects.rs:4:11
  |
4 | use std::{cmp::max, collections::HashSet};
  |           ^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused variable: `vector12`
  --> src/game_objects.rs:28:13
   |
28 |         let vector12: Vector = Vector::new(&coordinates[0], &coordinates[1]);
   |             ^^^^^^^^ help: consider prefixing with an underscore: `_vector12`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: function cannot return without recursing
  --> src/game_objects/structs.rs:70:5
   |
70 |     fn next(&mut self) -> Option<Self::Item> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
71 |         self.next()
   |         ----------- recursive call site
   |
   = note: `#[warn(unconditional_recursion)]` on by default
   = help: a `loop` may express intention better if this is on purpose

warning: function cannot return without recursing
   --> src/game_objects/structs.rs:124:5
    |
124 |     fn next(&mut self) -> Option<Self::Item> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
125 |         self.next()
    |         ----------- recursive call site
    |
    = help: a `loop` may express intention better if this is on purpose

    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `target/debug/n-dim-ttt -i 4`

thread 'main' has overflowed its stack
fatal runtime error: stack overflow
Aborted
[2020-03-12 20:24:48] 134 x10an14@x10-desktop:~/gitlab/n-dim-ttt                                                                                                                                                                                            (master=)
-> $ 

at git checkout 5f7eea2ac51593cf257c62f9a7c25f331ff7226ain my earlier mentioned gitlab git repo.