Stream: beginners

Topic: How to use Debug Flags?


view this post on Zulip Luke Boswell (Oct 27 2022 at 07:20):

Thanks to our new rust docs I discovered debug_flags and am currently trying to use it but not having much luck. I'm sure there is an obvious answer.

//! Flags for debugging the Roc compiler.
//!
//! Lists environment variable flags that can be enabled for verbose debugging features in debug
//! builds of the compiler.

I've updated my .cargo/config and changed the flags to "1". I'm using nix with nix develop, then cargo build, and then try to run an example with ./target/debug/roc examples/helloWorld.roc --debug but it doesn't print anything. What am I missing here?

view this post on Zulip Brian Carroll (Oct 27 2022 at 07:31):

The --debug flag is not relevant to this. That's for debugging the application that the compiler produces. But these flags are for debugging the compiler itself.

view this post on Zulip Brian Carroll (Oct 27 2022 at 07:32):

I don't actually know how to use them from that cargo config thing, I've never used them that way.
The way I do it is
MY_ROC_FLAG=1 ./target/debug/roc examples/helloWorld.roc

view this post on Zulip Brian Carroll (Oct 27 2022 at 07:33):

Or actually more often
MY_ROC_FLAG=1 cargo run examples/helloWorld.roc

view this post on Zulip Brian Carroll (Oct 27 2022 at 07:33):

Since if you are debugging the compiler it's probably because you just changed some of its source code and you need to rebuild it

view this post on Zulip Brian Carroll (Oct 27 2022 at 07:38):

This might be more of a "contributing" topic really!

view this post on Zulip Salman Shaik (Oct 27 2022 at 12:31):

Luke Boswell said:

Thanks to our new rust docs I discovered debug_flags and am currently trying to use it but not having much luck. I'm sure there is an obvious answer.

//! Flags for debugging the Roc compiler.
//!
//! Lists environment variable flags that can be enabled for verbose debugging features in debug
//! builds of the compiler.

I've updated my .cargo/config and changed the flags to "1". I'm using nix with nix develop, then cargo build, and then try to run an example with ./target/debug/roc examples/helloWorld.roc --debug but it doesn't print anything. What am I missing here?

Can we make the nav bar static please?

Please refer the https://ziglang.org/documentation/0.9.1/ for reference

view this post on Zulip Ayaz Hafiz (Oct 27 2022 at 13:04):

Yeah if you set them in .cargo/config you’ll need to rebuild with “cargo run”. If you have a debug build of the compiler you can just set the vars when calling the roc binary directly as Brian mentioned.


Last updated: Jul 06 2025 at 12:14 UTC