Macros: when and why is #if !macro / #if macro required?

AFAICT, Nim and Rust have macros comparable to haxe. (AST macros, quasi-quoting,can be used as decorator/metadata)

In nim, I personally have never wrote any macros, but -

they do not seem to require any conditional compilation to separate the context. The compiler determines what code to execute in which context automatically.

Same for rust AFAIK. proc macros (ast macros) can (i think) only be used as decorators (or whatever is the right terminology), so the compiler knows that it is to be performed at compile time context. The normal macros (not ast macros? idk), require an exclamation mark see code here Formatted print - Rust By Example , the macro is called by print!(…) so the compiler again knows to run it at compile time.
Again, my knowledge of these languages is not much (I come from mainstream languages C/Java/python), so I may be wrong about how the compiler detects which code to execute at compile time, but that is what those compilers do, I looked at many examples for both these languages, and I have never seen haxe like #if macro used anywhere.