The compile_fail flag ensures that the given code blocks don't compile. As simple as that. It's mostly used when you're showing bad code and demonstrating why it is bad. For example:
/// ```compile_fail /// let x = 0; /// x += 2; // Damn! `x` isn't mutable so you cannot update it... /// ```
Then you just write a small explanation about what went wrong and show a working example. It's very common in tutorials, to help users understand why it's wrong and how to fix it.
In addition to this, please note that there will be a graphical indication that this block is supposed to fail at compilation:
Figure 10.8
And when you hover over the sign:
Figure 10.9
Let's continue with no_run!