From 5f390cfb722cf95b0df81f9563bf97b1663cff9e Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sat, 23 Oct 2021 22:51:22 +0300 Subject: Add tests for `const_slice_from_ref` and `const_array_from_ref` --- library/core/tests/array.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'library/core/tests/array.rs') 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] -- cgit 1.4.1-3-g733a5