Auto merge of #75071 - ssomers:btree_cleanup_5, r=Mark-Simulacrum
Auto merge of #75071 - ssomers:btree_cleanup_5, r=Mark-Simulacrum

BTreeMap: enforce the panic rule imposed by `replace`

Also, reveal the unsafe parts in the closures fed to it.

r? @Mark-Simulacrum

aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust