Skip to content

Silent failure if app.run() is left out #5386

@cdrch

Description

@cdrch

Bevy version

Bevy 0.7.0.

System information

Running Rust stable 1.62.0 on Windows 10.

What you did

I accidentally deleted .run() from the end of a long chain of systems and plugins being set up in main(), but without deleting the semicolon after (therefore producing no errors).

What went wrong

The game ran, but instantly exited without problems. This is technically expected behavior, but feels extremely unintuitive that a game engine might not provide an explicit warning if you don't activate a main loop of some sort. This would prevent, say, 15 minutes of debugging with impossible results before a programmer remembers it would be quicker to check the diff from the last git commit. Hypothetically, I mean.

Suggested fix

A #[must_use] on the functions that return what .run() uses seems like a reasonable idea. (Thanks to @BoxyUwU for the idea.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AppBevy apps and pluginsC-BugAn unexpected or incorrect behaviorD-ComplexQuite challenging from either a design or technical perspective. Ask for help!S-Needs-DesignThis issue requires design work to think about how it would best be accomplished

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions