Skip to content

Commit ac921dd

Browse files
committed
Add tests for feature(const_identity_convert)
1 parent 1928d89 commit ac921dd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/test/ui/consts/convert.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// run-pass
2+
3+
#![feature(const_trait_impl)]
4+
#![feature(const_identity_convert)]
5+
6+
fn main() {
7+
const fn from(x: i32) -> i32 {
8+
i32::from(x)
9+
}
10+
11+
const FOO: i32 = from(42);
12+
assert_eq!(FOO, 42);
13+
14+
const fn into(x: Vec<String>) -> Vec<String> {
15+
x.into()
16+
}
17+
18+
const BAR: Vec<String> = into(Vec::new());
19+
20+
assert_eq!(BAR, Vec::<String>::new());
21+
}

0 commit comments

Comments
 (0)