Abort compilation from procedural macro

Hi there!

I'm currently writing a little procedural macro, which generates quite a lot of code to use in other parts of the source code.

The problem is that this macro can fail (e.g. if the provided attribute isn't correct). What I'd like to do is make the whole build abort if the proc macro fails (= panics).

Currently, when the macro panics, it is just counted as a "normal" error and the build goes on, which will make the compiler output dozens of "item not found" errors, which is not relevant. I'd like to prevent that.

How could I achieve this?

Thanks in advance for your help! :slightly_smiling_face:

I don't think you can do that.

(Though afaik it's usually better to emit a compile_error! macro over panicking)

1 Like

Ok, thanks for your help :slight_smile: