File tree 5 files changed +83
-1
lines changed
crates/bevy_reflect/compile_fail
5 files changed +83
-1
lines changed Original file line number Diff line number Diff line change @@ -16,3 +16,7 @@ compile_fail_utils = { path = "../../../tools/compile_fail_utils" }
16
16
[[test ]]
17
17
name = " derive"
18
18
harness = false
19
+
20
+ [[test ]]
21
+ name = " func"
22
+ harness = false
Original file line number Diff line number Diff line change 1
1
fn main ( ) -> compile_fail_utils:: ui_test:: Result < ( ) > {
2
- compile_fail_utils:: test ( "tests/reflect_derive" )
2
+ // compile_fail_utils::test("tests/reflect_derive")
3
+ Ok ( ( ) )
3
4
}
Original file line number Diff line number Diff line change
1
+ fn main ( ) -> compile_fail_utils:: ui_test:: Result < ( ) > {
2
+ compile_fail_utils:: test ( "tests/into_function" )
3
+ }
Original file line number Diff line number Diff line change
1
+ #![ allow( unused) ]
2
+
3
+ use bevy_reflect:: func:: IntoFunction ;
4
+ use bevy_reflect:: Reflect ;
5
+
6
+ fn pass ( _: i32 ) { }
7
+
8
+ fn too_many_arguments (
9
+ arg0 : i32 ,
10
+ arg1 : i32 ,
11
+ arg2 : i32 ,
12
+ arg3 : i32 ,
13
+ arg4 : i32 ,
14
+ arg5 : i32 ,
15
+ arg6 : i32 ,
16
+ arg7 : i32 ,
17
+ arg8 : i32 ,
18
+ arg9 : i32 ,
19
+ arg10 : i32 ,
20
+ arg11 : i32 ,
21
+ arg12 : i32 ,
22
+ arg13 : i32 ,
23
+ arg14 : i32 ,
24
+ arg15 : i32 ,
25
+ ) {
26
+ }
27
+
28
+ struct Foo ;
29
+
30
+ fn argument_not_reflect ( foo : Foo ) { }
31
+
32
+ fn main ( ) {
33
+ let _ = pass. into_function ( ) ;
34
+
35
+ let _ = too_many_arguments. into_function ( ) ;
36
+ //~^ ERROR: no method named `into_function` found
37
+
38
+ let _ = argument_not_reflect. into_function ( ) ;
39
+ //~^ ERROR: no method named `into_function` found
40
+ }
Original file line number Diff line number Diff line change
1
+ #![ allow( unused) ]
2
+
3
+ use bevy_reflect:: func:: IntoFunction ;
4
+ use bevy_reflect:: Reflect ;
5
+
6
+ fn pass ( ) -> i32 {
7
+ 123
8
+ }
9
+
10
+ struct Foo ;
11
+
12
+ fn return_not_reflect ( ) -> Foo {
13
+ Foo
14
+ }
15
+
16
+ fn return_with_lifetime_pass < ' a > ( a : & ' a String ) -> & ' a String {
17
+ a
18
+ }
19
+
20
+ fn return_with_invalid_lifetime < ' a , ' b > ( a : & ' a String , b : & ' b String ) -> & ' b String {
21
+ b
22
+ }
23
+
24
+ fn main ( ) {
25
+ let _ = pass. into_function ( ) ;
26
+
27
+ let _ = return_not_reflect. into_function ( ) ;
28
+ //~^ ERROR: no method named `into_function` found
29
+
30
+ let _ = return_with_lifetime_pass. into_function ( ) ;
31
+
32
+ let _ = return_with_invalid_lifetime. into_function ( ) ;
33
+ //~^ ERROR: no method named `into_function` found
34
+ }
You can’t perform that action at this time.
0 commit comments