{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreiexvjck3ovffuacbog26welswrqezi55kx4p6x2pb6ddlr3kltupu",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mk3vekouchm2"
},
"path": "/t/pre-rfc-a-tiny-internal-change-to-reverse-copy-from-slice-swap-with-slice/24189#post_2",
"publishedAt": "2026-04-22T15:23:32.000Z",
"site": "https://internals.rust-lang.org",
"tags": [
"rust/compiler/rustc_mir_transform/src/lower_slice_len.rs at main · rust-lang/rust · GitHub"
],
"textContent": "The core thing to me with this is that if you did this, I expect someone will change it back to the other way since it's \"obviously\" unnecessary.\n\nWhat's your plan to have a test for it to keep it from regressing?\n\n* * *\n\nBut at a broader level, note that `.len()` _is_ special. We do things like rust/compiler/rustc_mir_transform/src/lower_slice_len.rs at main · rust-lang/rust · GitHub that special-case it already. It's special in the ABI since `.len()` is actually just looking at a function parameter, etc.\n\nSo I think you should just support this. Could probably even enable that particular mir pass if you need it.",
"title": "[Pre-RFC] A tiny internal change to `reverse`, `copy_from_slice`, `swap_with_slice`"
}