about summary refs log tree commit diff
path: root/library/core/tests/array.rs
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2021-10-23 22:51:22 +0300
committerMaybe Waffle <waffle.lapkin@gmail.com>2021-10-23 22:51:22 +0300
commit5f390cfb722cf95b0df81f9563bf97b1663cff9e (patch)
treedef8b2963423180644bbdad113cfe525e9e0539b /library/core/tests/array.rs
parent27d69611347142cc5f103df0923b46d670e75739 (diff)
downloadrust-5f390cfb722cf95b0df81f9563bf97b1663cff9e.tar.gz
rust-5f390cfb722cf95b0df81f9563bf97b1663cff9e.zip
Add tests for `const_slice_from_ref` and `const_array_from_ref`
Diffstat (limited to 'library/core/tests/array.rs')
-rw-r--r--library/core/tests/array.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/library/core/tests/array.rs b/library/core/tests/array.rs
index b3af1328c90..d10bb4bce3c 100644
--- a/library/core/tests/array.rs
+++ b/library/core/tests/array.rs
@@ -7,6 +7,11 @@ fn array_from_ref() {
     let value: String = "Hello World!".into();
     let arr: &[String; 1] = array::from_ref(&value);
     assert_eq!(&[value.clone()], arr);
+
+    const VALUE: &&str = &"Hello World!";
+    const ARR: &[&str; 1] = array::from_ref(VALUE);
+    assert_eq!(&[*VALUE], ARR);
+    assert!(core::ptr::eq(VALUE, &ARR[0]));
 }
 
 #[test]