Support closure in clone shim

This commit is contained in:
hkalbasi 2023-08-08 01:49:34 +03:30
parent b96e4f2f4a
commit 31c30933cf
2 changed files with 73 additions and 21 deletions

View file

@ -1453,6 +1453,30 @@ fn from_trait() {
);
}
#[test]
fn closure_clone() {
check_number(
r#"
//- minicore: clone, fn
struct S(u8);
impl Clone for S(u8) {
fn clone(&self) -> S {
S(self.0 + 5)
}
}
const GOAL: u8 = {
let s = S(3);
let cl = move || s;
let cl = cl.clone();
cl().0
}
"#,
8,
);
}
#[test]
fn builtin_derive_macro() {
check_number(