Remove old FIXMEs about nocapture attribute#157733
Merged
Merged
Conversation
Collaborator
|
r? @mati865 rustbot has assigned @mati865. Use Why was this reviewer chosen?The reviewer was selected based on:
|
88fb7c3 to
befdb77
Compare
This comment has been minimized.
This comment has been minimized.
As discussed in the long-closed issue referenced by the FIXMEs, 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.
befdb77 to
460f825
Compare
Collaborator
|
A job failed! Check out the build log: (web) (plain enhanced) (plain) Click to see the possible cause of the failure (guessed by this bot) |
mati865
approved these changes
Jun 11, 2026
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jun 11, 2026
…ti865 Remove old FIXMEs about nocapture attribute As discussed in the long-closed issue referenced by the FIXMEs (rust-lang#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 rust-lang#44366
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jun 11, 2026
…ti865 Remove old FIXMEs about nocapture attribute As discussed in the long-closed issue referenced by the FIXMEs (rust-lang#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 rust-lang#44366
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 11, 2026
…uwer Rollup of 23 pull requests Successful merges: - #157716 (update Enzyme, June'26) - #149793 (Add inline asm support for amdgpu) - #152852 (Remove driver_lint_caps) - #155299 (make repr_transparent_non_zst_fields a hard error) - #155439 (Enable Cargo's new build-dir layout) - #157612 (Add a test where subtyping inhibits coercion.) - #157626 (Autogenerate unstable compiler flag stubs for unstable-book) - #157667 (Rename typing modes to better describe real usage) - #156212 (Additionally gate negative bounds behind new `-Zinternal-testing-features`) - #157342 (Reduce verbosity of cycle errors when possible) - #157366 (Add a regression test for an unconstrained TransmuteFrom ICE) - #157459 (rustc_target: callconv: powerpc64: Remove unreachable fallback code path) - #157658 (UnsafeCell: mention shared-ref-to-interior case, fix aliasing model inaccuracy) - #157698 (Remove an unnecessary cloning) - #157699 (Arg splat experiment - hir FnDecl impl) - #157713 (resolve: Remove exported imports from `maybe_unused_trait_imports`) - #157722 (Move create_scope_map to rustc_codegen_ssa.) - #157725 (Keep generic suggestion for macro-expanded missing-type items) - #157733 (Remove old FIXMEs about nocapture attribute) - #157737 (Reorganize `tests/ui/issues` [7/N]) - #157746 (supports_c_variadic_definitions: extend checklist for new targets) - #157763 (Move unused target expression error to appropriate place and rename it) - #157768 (codegen_ssa: peel trans. wrappers on scalable vecs)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 11, 2026
…uwer Rollup of 23 pull requests Successful merges: - #157716 (update Enzyme, June'26) - #149793 (Add inline asm support for amdgpu) - #152852 (Remove driver_lint_caps) - #155299 (make repr_transparent_non_zst_fields a hard error) - #155439 (Enable Cargo's new build-dir layout) - #157612 (Add a test where subtyping inhibits coercion.) - #157626 (Autogenerate unstable compiler flag stubs for unstable-book) - #157667 (Rename typing modes to better describe real usage) - #156212 (Additionally gate negative bounds behind new `-Zinternal-testing-features`) - #157342 (Reduce verbosity of cycle errors when possible) - #157366 (Add a regression test for an unconstrained TransmuteFrom ICE) - #157459 (rustc_target: callconv: powerpc64: Remove unreachable fallback code path) - #157658 (UnsafeCell: mention shared-ref-to-interior case, fix aliasing model inaccuracy) - #157698 (Remove an unnecessary cloning) - #157699 (Arg splat experiment - hir FnDecl impl) - #157713 (resolve: Remove exported imports from `maybe_unused_trait_imports`) - #157722 (Move create_scope_map to rustc_codegen_ssa.) - #157725 (Keep generic suggestion for macro-expanded missing-type items) - #157733 (Remove old FIXMEs about nocapture attribute) - #157737 (Reorganize `tests/ui/issues` [7/N]) - #157746 (supports_c_variadic_definitions: extend checklist for new targets) - #157763 (Move unused target expression error to appropriate place and rename it) - #157768 (codegen_ssa: peel trans. wrappers on scalable vecs)
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jun 11, 2026
…ti865 Remove old FIXMEs about nocapture attribute As discussed in the long-closed issue referenced by the FIXMEs (rust-lang#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 rust-lang#44366
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 11, 2026
…uwer Rollup of 23 pull requests Successful merges: - #157716 (update Enzyme, June'26) - #149793 (Add inline asm support for amdgpu) - #155299 (make repr_transparent_non_zst_fields a hard error) - #155439 (Enable Cargo's new build-dir layout) - #157612 (Add a test where subtyping inhibits coercion.) - #157626 (Autogenerate unstable compiler flag stubs for unstable-book) - #157667 (Rename typing modes to better describe real usage) - #149749 (Make `BorrowedBuf` and `BorrowedCursor` generic over the data) - #156212 (Additionally gate negative bounds behind new `-Zinternal-testing-features`) - #157342 (Reduce verbosity of cycle errors when possible) - #157366 (Add a regression test for an unconstrained TransmuteFrom ICE) - #157459 (rustc_target: callconv: powerpc64: Remove unreachable fallback code path) - #157658 (UnsafeCell: mention shared-ref-to-interior case, fix aliasing model inaccuracy) - #157698 (Remove an unnecessary cloning) - #157699 (Arg splat experiment - hir FnDecl impl) - #157713 (resolve: Remove exported imports from `maybe_unused_trait_imports`) - #157722 (Move create_scope_map to rustc_codegen_ssa.) - #157725 (Keep generic suggestion for macro-expanded missing-type items) - #157733 (Remove old FIXMEs about nocapture attribute) - #157737 (Reorganize `tests/ui/issues` [7/N]) - #157746 (supports_c_variadic_definitions: extend checklist for new targets) - #157763 (Move unused target expression error to appropriate place and rename it) - #157768 (codegen_ssa: peel trans. wrappers on scalable vecs)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 12, 2026
Rollup of 24 pull requests Successful merges: - #157716 (update Enzyme, June'26) - #149793 (Add inline asm support for amdgpu) - #155299 (make repr_transparent_non_zst_fields a hard error) - #157612 (Add a test where subtyping inhibits coercion.) - #157626 (Autogenerate unstable compiler flag stubs for unstable-book) - #157667 (Rename typing modes to better describe real usage) - #149749 (Make `BorrowedBuf` and `BorrowedCursor` generic over the data) - #155113 (Ensure Send/Sync impl for std::process::CommandArgs) - #156212 (Additionally gate negative bounds behind new `-Zinternal-testing-features`) - #157342 (Reduce verbosity of cycle errors when possible) - #157366 (Add a regression test for an unconstrained TransmuteFrom ICE) - #157459 (rustc_target: callconv: powerpc64: Remove unreachable fallback code path) - #157658 (UnsafeCell: mention shared-ref-to-interior case, fix aliasing model inaccuracy) - #157698 (Remove an unnecessary cloning) - #157699 (Arg splat experiment - hir FnDecl impl) - #157713 (resolve: Remove exported imports from `maybe_unused_trait_imports`) - #157722 (Move create_scope_map to rustc_codegen_ssa.) - #157723 (Move uninhabited unreachable code lint to rustc_mir_transform) - #157725 (Keep generic suggestion for macro-expanded missing-type items) - #157733 (Remove old FIXMEs about nocapture attribute) - #157737 (Reorganize `tests/ui/issues` [7/N]) - #157746 (supports_c_variadic_definitions: extend checklist for new targets) - #157763 (Move unused target expression error to appropriate place and rename it) - #157768 (codegen_ssa: peel trans. wrappers on scalable vecs)
rust-timer
added a commit
that referenced
this pull request
Jun 12, 2026
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
pull Bot
pushed a commit
to xtqqczze/rust-lang-miri
that referenced
this pull request
Jun 13, 2026
Rollup of 24 pull requests Successful merges: - rust-lang/rust#157716 (update Enzyme, June'26) - rust-lang/rust#149793 (Add inline asm support for amdgpu) - rust-lang/rust#155299 (make repr_transparent_non_zst_fields a hard error) - rust-lang/rust#157612 (Add a test where subtyping inhibits coercion.) - rust-lang/rust#157626 (Autogenerate unstable compiler flag stubs for unstable-book) - rust-lang/rust#157667 (Rename typing modes to better describe real usage) - rust-lang/rust#149749 (Make `BorrowedBuf` and `BorrowedCursor` generic over the data) - rust-lang/rust#155113 (Ensure Send/Sync impl for std::process::CommandArgs) - rust-lang/rust#156212 (Additionally gate negative bounds behind new `-Zinternal-testing-features`) - rust-lang/rust#157342 (Reduce verbosity of cycle errors when possible) - rust-lang/rust#157366 (Add a regression test for an unconstrained TransmuteFrom ICE) - rust-lang/rust#157459 (rustc_target: callconv: powerpc64: Remove unreachable fallback code path) - rust-lang/rust#157658 (UnsafeCell: mention shared-ref-to-interior case, fix aliasing model inaccuracy) - rust-lang/rust#157698 (Remove an unnecessary cloning) - rust-lang/rust#157699 (Arg splat experiment - hir FnDecl impl) - rust-lang/rust#157713 (resolve: Remove exported imports from `maybe_unused_trait_imports`) - rust-lang/rust#157722 (Move create_scope_map to rustc_codegen_ssa.) - rust-lang/rust#157723 (Move uninhabited unreachable code lint to rustc_mir_transform) - rust-lang/rust#157725 (Keep generic suggestion for macro-expanded missing-type items) - rust-lang/rust#157733 (Remove old FIXMEs about nocapture attribute) - rust-lang/rust#157737 (Reorganize `tests/ui/issues` [7/N]) - rust-lang/rust#157746 (supports_c_variadic_definitions: extend checklist for new targets) - rust-lang/rust#157763 (Move unused target expression error to appropriate place and rename it) - rust-lang/rust#157768 (codegen_ssa: peel trans. wrappers on scalable vecs)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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