So… this is going to sound silly.
I’m trying to hunt down a specific github issue that I know I saw on the tracker—but that I never commented in or subscribed to—because seeing it will remind me of how to create a soundness bug.
Some months ago, I think when NLL was riding the nightly and beta trains into stable, an inconspicuous issue appeared on the tracker with a vague title in broken English—like, “Lifetime is not as helpful as they could be” or something like that. The poster was annoyed that rust did not catch a bug in their program. The last time I saw it, it was a week old and had 0 comments, and appeared to be doomed to forever remain that way.
If I recall, the OP’s code sample compiled on nightly, but not on stable, so it was an example of something “newly allowed by NLL.” The code sample used a
&'static mut in some manner (I think as a member of a struct?) that seemingly ought to have made the borrow checker mad. Playing around with the sample more, I eventually came up with an example of true UB that was enabled by the change.
However, the UB was only possible if you possessed a
&'static mut T. I kept trying but I couldn’t come up with any way to create a
&'static mut T without using
unsafe… and then life moved on and I never posted my comment.
…then today, I suddenly remembered that
Box::leak exists, but I can’t remember what I did to create UB before! Seeing the issue would help jog my memory, but I can’t seem to find it any more even with some really vague search queries.
Maybe the issue was renamed? The bug has probably already been found and fixed, but I just want some peace of mind…