Skip to content

Commit b85107e

Browse files
committed
Add tests for feature(const_identity_convert)
1 parent b82aaf4 commit b85107e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/test/ui/consts/convert.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
assert_eq!(BAR, Vec::<String>::new());
20+
}

0 commit comments

Comments
 (0)