You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #157733 - hanna-kruppe:fixme-nocapture, r=mati865
Remove old FIXMEs about nocapture attribute
As discussed in the long-closed issue referenced by the FIXMEs (#25759), it would be unsound to add nocapture to all reference arguments. The canonical example is taking &T and returning *const T, i.e., `std::ptr::from_ref`. Some of the removed test cases suggest that named vs elided vs static lifetime on the reference would make a difference for capturing, which is incompatible with all modern takes on Rust opsem.
Hypothetically, we could add some kind of escape analysis on MIR to determine which arguments can be marked as nocapture. But LLVM can do that too (often better), so why should we? Plus, if we started doing such analysis, the test that had the FIXMEs would not be a good place to exercise it, as all the function bodies are trivial.
Part of #44366
0 commit comments