diff options
| author | Nikita Popov <npopov@redhat.com> | 2025-08-11 17:18:23 +0200 |
|---|---|---|
| committer | Nikita Popov <npopov@redhat.com> | 2025-08-20 19:08:16 +0200 |
| commit | d71ed8d19bcfdbd6eb3bf2620071f2ab95470a57 (patch) | |
| tree | e741340c424decbc74d41bf783747f1440e4ca10 /compiler/rustc_ty_utils/src | |
| parent | 8365fcb2b840c95eeb0bc377af8bd498fad22245 (diff) | |
| download | rust-d71ed8d19bcfdbd6eb3bf2620071f2ab95470a57.tar.gz rust-d71ed8d19bcfdbd6eb3bf2620071f2ab95470a57.zip | |
Tell LLVM about read-only captures
`&Freeze` parameters are not only `readonly` within the function, but any captures of the pointer can also only be used for reads. This can now be encoded using the `captures(address, read_provenance)` attribute.
Diffstat (limited to 'compiler/rustc_ty_utils/src')
| -rw-r--r-- | compiler/rustc_ty_utils/src/abi.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs index 89d1dd8cf23..e4ed084b073 100644 --- a/compiler/rustc_ty_utils/src/abi.rs +++ b/compiler/rustc_ty_utils/src/abi.rs @@ -356,6 +356,7 @@ fn arg_attrs_for_rust_scalar<'tcx>( if matches!(kind, PointerKind::SharedRef { frozen: true }) && !is_return { attrs.set(ArgAttribute::ReadOnly); + attrs.set(ArgAttribute::CapturesReadOnly); } } } |
