Debug and release builds
You may have noticed that the program was in a directory called target/debug. What's that about? By default, cargo builds our program in debug mode, which is what a programmer normally wants.
That means that the resulting program is instrumented to work with the rust-gdb debugging program so we can examine what is happening in its internals, and to provide useful information in crash dumps and such, as well as skipping the compiler's optimization phase. The optimizations are skipped because they rearrange things in such a way that it makes debugging information almost incomprehensible.
However, sometimes a program doesn't have any more bugs (that we know about) and we're ready to ship it out to others. To construct ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access