about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2024-04-02 20:37:39 -0400
committerGitHub <noreply@github.com>2024-04-02 20:37:39 -0400
commite9ef8e1efa387fa235d63c191492f63f70959348 (patch)
tree4935ba4905ceb6d899d6974c036f1f8277103cf2 /tests
parent0697ee9af5a0493631606e5fbe80cc802a95eb23 (diff)
parentf2cff5ebb9ebc9712eec88dd5ec578f76efb33bc (diff)
downloadrust-e9ef8e1efa387fa235d63c191492f63f70959348.tar.gz
rust-e9ef8e1efa387fa235d63c191492f63f70959348.zip
Rollup merge of #122935 - RalfJung:with-exposed-provenance, r=Amanieu
rename ptr::from_exposed_addr -> ptr::with_exposed_provenance

As discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/To.20expose.20or.20not.20to.20expose/near/427757066).

The old name, `from_exposed_addr`, makes little sense as it's not the address that is exposed, it's the provenance. (`ptr.expose_addr()` stays unchanged as we haven't found a better option yet. The intended interpretation is "expose the provenance and return the address".)

The new name nicely matches `ptr::without_provenance`.
Diffstat (limited to 'tests')
-rw-r--r--tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir2
-rw-r--r--tests/mir-opt/const_prop/reify_fn_ptr.main.GVN.diff2
-rw-r--r--tests/mir-opt/const_prop/reify_fn_ptr.rs2
-rw-r--r--tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr2
-rw-r--r--tests/ui/simd/intrinsic/ptr-cast.rs6
5 files changed, 7 insertions, 7 deletions
diff --git a/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir b/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir
index 0dc46d61eff..faff79e8c57 100644
--- a/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir
+++ b/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir
@@ -4,7 +4,7 @@ fn int_to_ptr(_1: usize) -> *const i32 {
     let mut _0: *const i32;
 
     bb0: {
-        _0 = _1 as *const i32 (PointerFromExposedAddress);
+        _0 = _1 as *const i32 (PointerWithExposedProvenance);
         return;
     }
 }
diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.main.GVN.diff b/tests/mir-opt/const_prop/reify_fn_ptr.main.GVN.diff
index cde0cb32f75..2f76e74a3f8 100644
--- a/tests/mir-opt/const_prop/reify_fn_ptr.main.GVN.diff
+++ b/tests/mir-opt/const_prop/reify_fn_ptr.main.GVN.diff
@@ -16,7 +16,7 @@
           _3 = main as fn() (PointerCoercion(ReifyFnPointer));
           _2 = move _3 as usize (PointerExposeAddress);
           StorageDead(_3);
-          _1 = move _2 as *const fn() (PointerFromExposedAddress);
+          _1 = move _2 as *const fn() (PointerWithExposedProvenance);
           StorageDead(_2);
           StorageDead(_1);
           _0 = const ();
diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.rs b/tests/mir-opt/const_prop/reify_fn_ptr.rs
index ad73b084219..4e897d22768 100644
--- a/tests/mir-opt/const_prop/reify_fn_ptr.rs
+++ b/tests/mir-opt/const_prop/reify_fn_ptr.rs
@@ -5,6 +5,6 @@ fn main() {
     // CHECK-LABEL: fn main(
     // CHECK: [[ptr:_.*]] = main as fn() (PointerCoercion(ReifyFnPointer));
     // CHECK: [[addr:_.*]] = move [[ptr]] as usize (PointerExposeAddress);
-    // CHECK: [[back:_.*]] = move [[addr]] as *const fn() (PointerFromExposedAddress);
+    // CHECK: [[back:_.*]] = move [[addr]] as *const fn() (PointerWithExposedProvenance);
     let _ = main as usize as *const fn();
 }
diff --git a/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr b/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr
index 0b128974275..24f2500abf8 100644
--- a/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr
+++ b/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr
@@ -4,7 +4,7 @@ error: strict provenance disallows casting integer `usize` to pointer `*const u8
 LL |     let dangling = 16_usize as *const u8;
    |                    ^^^^^^^^^^^^^^^^^^^^^
    |
-   = help: if you can't comply with strict provenance and don't have a pointer with the correct provenance you can use `std::ptr::from_exposed_addr()` instead
+   = help: if you can't comply with strict provenance and don't have a pointer with the correct provenance you can use `std::ptr::with_exposed_provenance()` instead
 note: the lint level is defined here
   --> $DIR/lint-strict-provenance-fuzzy-casts.rs:2:9
    |
diff --git a/tests/ui/simd/intrinsic/ptr-cast.rs b/tests/ui/simd/intrinsic/ptr-cast.rs
index 83d86baf334..62820346241 100644
--- a/tests/ui/simd/intrinsic/ptr-cast.rs
+++ b/tests/ui/simd/intrinsic/ptr-cast.rs
@@ -5,7 +5,7 @@
 extern "rust-intrinsic" {
     fn simd_cast_ptr<T, U>(x: T) -> U;
     fn simd_expose_addr<T, U>(x: T) -> U;
-    fn simd_from_exposed_addr<T, U>(x: T) -> U;
+    fn simd_with_exposed_provenance<T, U>(x: T) -> U;
 }
 
 #[derive(Copy, Clone)]
@@ -24,10 +24,10 @@ fn main() {
 
         let exposed_addr: V<usize> = simd_expose_addr(const_ptrs);
 
-        let from_exposed_addr: V<*mut i8> = simd_from_exposed_addr(exposed_addr);
+        let with_exposed_provenance: V<*mut i8> = simd_with_exposed_provenance(exposed_addr);
 
         assert!(const_ptrs.0 == [ptr as *const u8, core::ptr::null()]);
         assert!(exposed_addr.0 == [ptr as usize, 0]);
-        assert!(from_exposed_addr.0 == ptrs.0);
+        assert!(with_exposed_provenance.0 == ptrs.0);
     }
 }