External Publication
Visit Post

Stop including string content in index panics?

Rust Internals [Unofficial] March 10, 2026
Source

I pushed up a PR to Remove string content from panics by ConradIrwin · Pull Request #153677 · rust-lang/rust · GitHub.

What kind of mechanism do you have in mind for having a “flag”?

I was imagining something like the Cargo feature flags (though I don't actually know if you can apply those to the standard library). If not, we could also tie this to cfg!(debug_assertions).

My thought is including string content is a potential security/GDPR problem. I would agree it should not be included.

Potential security problem is my top-most concern (it seems more likely that developers will have API keys in their buffers than PII); but either way it's not great.

Luckily, although this is common in terms of the panics we get; it's very rare when divided by the total Zed user-base, and to my knowledge we've never actually seen anything that would be considered sensitive. I'd like to fix this before we do though

That should be relatively easy to notice with an automated test though, shouldn’t it? Just run a test for a great variety of possible of out-of-bounds errors (including all existing flavors that are differentiated) in order to be able to be notified of any future changes in the panic message formatting, and have that test be executed whenever Zed upgrades to use a newer Rust toolchain.

Working around the problem for just Zed seems to leave the whole ecosystem in a bad place (and the effort to build all that is - in my opinion - more work than fixing the problem in the right place).

Discussion in the ATmosphere

Loading comments...