about summary refs log tree commit diff
path: root/library/core/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-11-18 12:45:42 +0000
committerbors <bors@rust-lang.org>2023-11-18 12:45:42 +0000
commit33688d24673db07df084483cbcf0b6bc569ea33a (patch)
tree056df890273040d3058cf638bd9716bd51d4e23c /library/core/tests
parente1e60b6976ed51e9464d15a2888d90c577dda223 (diff)
parent58ea02e872f101717d9e2e3dfb308b4897c9c904 (diff)
downloadrust-33688d24673db07df084483cbcf0b6bc569ea33a.tar.gz
rust-33688d24673db07df084483cbcf0b6bc569ea33a.zip
Auto merge of #117525 - GKFX:remove_option_payload_ptr, r=petrochenkov
Remove option_payload_ptr; redundant to offset_of

The `option_payload_ptr` intrinsic is no longer required as `offset_of` supports traversing enums (#114208). This PR removes it in order to dogfood offset_of (as suggested at https://github.com/rust-lang/rust/issues/106655#issuecomment-1790907626). However, it will not build until those changes reach beta (which I think is within the next 8 days?) so I've opened it as a draft.
Diffstat (limited to 'library/core/tests')
-rw-r--r--library/core/tests/option.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/library/core/tests/option.rs b/library/core/tests/option.rs
index 5defeb50d40..5dc012bab4a 100644
--- a/library/core/tests/option.rs
+++ b/library/core/tests/option.rs
@@ -568,3 +568,11 @@ fn zip_unzip_roundtrip() {
     let a = z.unzip();
     assert_eq!(a, (x, y));
 }
+
+#[test]
+fn as_slice() {
+    assert_eq!(Some(42).as_slice(), &[42]);
+    assert_eq!(Some(43).as_mut_slice(), &[43]);
+    assert_eq!(None::<i32>.as_slice(), &[]);
+    assert_eq!(None::<i32>.as_mut_slice(), &[]);
+}