Skip to content

Commit 912d502

Browse files
committed
Add compile fail test
1 parent e751a30 commit 912d502

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//@no-rustfix
2+
#![allow(unused)]
3+
4+
use bevy_reflect::func::IntoFunction;
5+
use bevy_reflect::Reflect;
6+
7+
fn main() {
8+
let value = String::from("Hello, World!");
9+
let closure_capture_owned = move || println!("{}", value);
10+
11+
// Should pass:
12+
let _ = closure_capture_owned.into_function();
13+
14+
let value = String::from("Hello, World!");
15+
let closure_capture_reference = || println!("{}", &value);
16+
//~^ E0373
17+
18+
// Above error due to this line:
19+
let _ = closure_capture_reference.into_function();
20+
}

0 commit comments

Comments
 (0)