Type inference breaks when a loop is added between inference points
Rust Internals [Unofficial]
May 8, 2026
Even with rustc :
> rustc main.rs
error[E0282]: type annotations needed
--> main.rs:28:28
|
28 | println!("{}", n.node_id);
| ^ cannot infer type
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0282`.
You can test it using the playground link
rxdiscovery:
Here is the playground link.
Discussion in the ATmosphere