Share how safety tags are combined with function grouping/navigation

Safety tags are rendered as badges appended to the function names. Unsafe functions are in red.

It's included as a core feature in the UI tool I recently developed for safety tags.

May be more appropriate as a user forum post, but still posted here for cross-reference to a closed thread where I imagined for the function grouping:

2 Likes

I’ll push back on this a bit:

  • The red makes the unsafe functions stand out, but usually unsafe functions aren’t the first ones you want to look at, and often they’re even a “last resort” if you need to micro-optimize (not always, though). Is there a good way to de-emphasize them rather than emphasize?
  • Unsafe functions are usually pretty obviously unsafe once you click on to them, and many of them are even pretty clearly named “unchecked” or “raw” or similar (though many are not). Even if you don’t notice before trying to use a function, the compiler will stop you as long as you’re not already in an unsafe block. So, do we need them called out separately in docs at all?

Trying to be productive and not just critical: maybe “hide unsafe” would be a reasonable filter that could be applied to listings and/or search results. I think I still wouldn’t default that filter to active, though.

1 Like

Thanks for the feedback!

This tool focuses on soundness auditing via safety tags, so unsafe functions are highlighted.

The tool primarily serves crate authors and auditors, so functions only appear at where they are defined. You'll also find re-exports and visibility are not considered yet.