Add tests for feature(const_identity_convert)

This commit is contained in:
Albin Hedman 2021-08-02 14:42:29 +02:00
parent b82aaf4913
commit b85107ec71
No known key found for this signature in database
GPG Key ID: 1F501ECD1BBD70A7

View File

@ -0,0 +1,20 @@
// run-pass
#![feature(const_trait_impl)]
#![feature(const_identity_convert)]
fn main() {
const fn from(x: i32) -> i32 {
i32::from(x)
}
const FOO: i32 = from(42);
assert_eq!(FOO, 42);
const fn into(x: Vec<String>) -> Vec<String> {
x.into()
}
const BAR: Vec<String> = into(Vec::new());
assert_eq!(BAR, Vec::<String>::new());
}