We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d6fc3e1 commit 2788f66Copy full SHA for 2788f66
src/test/ui/const-eval/strlen.rs
@@ -8,12 +8,10 @@
8
// option. This file may not be copied, modified, or distributed
9
// except according to those terms.
10
11
-// compile-pass
+// run-pass
12
13
#![feature(const_str_len, const_str_as_bytes)]
14
15
-#![crate_type = "lib"]
16
-
17
const S: &str = "foo";
18
pub const B: &[u8] = S.as_bytes();
19
@@ -24,3 +22,12 @@ pub fn foo() -> [u8; S.len()] {
24
22
}
25
23
buf
26
+
+fn main() {
27
+ assert_eq!(&foo()[..], b"foo");
28
+ assert_eq!(foo().len(), S.len());
29
+ const LEN: usize = S.len();
30
+ assert_eq!(LEN, S.len());
31
+ assert_eq!(B, foo());
32
+ assert_eq!(B, b"foo");
33
+}
0 commit comments