mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Support closure in clone shim
This commit is contained in:
parent
b96e4f2f4a
commit
31c30933cf
2 changed files with 73 additions and 21 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue