Indicating that an example is "should_panic" in docs

At the moment, the should_panic and some related attributes can modify how doctests are run and what their intended behavior is. However, in the generated documentation, there is no indication that the code example panics, besides the "this causes a panic" comment that is typically included. What are people's thoughts on the idea of including some visual indicator that a particular code example panics?

If this seems desirable, what should this indicator look like? The Book uses Ferris for this, although I do not think that would be appropriate for general documentation. My tentative idea right now is to add a small red exclamation mark, but I'm not at all sure this is ideal.

2 Likes

I'm not quite sure I understand your question. My suggestion is to mark the example in some form based on the existence of the should_panic attribute. I do not think the particular cause of the panic should matter for this.

The docs already have an icon/tooltip for some situations (see here). It seems reasonable to me to do that for should_panic, too.

2 Likes