rust/library/core/tests/convert.rs
Deadbeef e22fe4008c
Revert "Auto merge of #89450 - usbalbin:const_try_revert, r=oli-obk"
This reverts commit a8387aef8c378a771686878062e544af4d5e2245, reversing
changes made to 6e1211081239be62a5d0bb3bbcb29a9f14621c81.
2021-12-12 12:34:59 +08:00

17 lines
310 B
Rust

#[test]
fn convert() {
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());
}