Nasty stack overflow segfault bug when implementing the Default
trait
#6207
Labels
A-Diagnostics
Logging, crash handling, error reporting and performance analysis
A-ECS
Entities, components, systems, and events
C-Bug
An unexpected or incorrect behavior
S-Blocked
This cannot move forward until something else changes
S-Duplicate
This issue or PR already exists
S-Needs-Investigation
This issue requires detective work to figure out what's going wrong
Bevy version
0.8.1
The issue
I stumbled upon a situation where when I spawned my player bundle the program would segfault with a stack overflow. With gdb I discovered that this occurred in the
default
function. The problem might be obvious to some:Namely, the
default
function is recursive and non terminating (I wrongly assumed that..default()
calls upon the Default trait of each respective field). This is quite problematic which is why in a non bevy project like this sandboxed example:rust analyzer produces a big fat warning about possible non termination. However, somehow when using the
..default()
syntax made available in the bevy prelude, rust analyzer is blind to the issue and lets you write a nasty bug like this. It would be good to research if it is possible to make sure that in the bevy case this warning is still emitted.The text was updated successfully, but these errors were encountered: