File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,15 @@ pub const IS_CODEGEN_FULL: bool = false;
5252pub const IS_CODEGEN_FULL : bool = true ;
5353
5454#[ cfg( all( feature = "experimental-required-objs" , before_api = "4.6" ) ) ]
55- compile_error ! ( "The `experimental-required-objs` feature needs at least Godot 4.6-dev version" ) ;
55+ fn __feature_warning ( ) {
56+ // Not a hard error, it's experimental anyway and allows more flexibility like this.
57+ #[ must_use = "The `experimental-required-objs` feature needs at least Godot 4.6-dev version" ]
58+ fn feature_has_no_effect ( ) -> i32 {
59+ 1
60+ }
61+
62+ feature_has_no_effect ( ) ;
63+ }
5664
5765fn write_file ( path : & Path , contents : String ) {
5866 let dir = path. parent ( ) . unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ crate-type = ["cdylib"]
1313# Default feature MUST be empty for workflow reasons, even if it differs from the default feature set in upstream `godot` crate.
1414default = []
1515codegen-full = [" godot/__codegen-full" ]
16- codegen-full-experimental = [" codegen-full" , " godot/experimental-godot-api" ]
16+ codegen-full-experimental = [" codegen-full" , " godot/experimental-godot-api" , " godot/experimental-required-objs " ]
1717experimental-threads = [" godot/experimental-threads" ]
1818register-docs = [" godot/register-docs" ]
1919serde = [" dep:serde" , " dep:serde_json" , " godot/serde" ]
Original file line number Diff line number Diff line change @@ -74,3 +74,25 @@ fn node_call_group(ctx: &TestContext) {
7474 tree. call_group ( "group" , "remove_meta" , vslice ! [ "something" ] ) ;
7575 assert ! ( !node. has_meta( "something" ) ) ;
7676}
77+
78+ // Experimental required parameter/return value: https://github.com/godot-rust/gdext/pull/1383.
79+ #[ cfg( all( feature = "codegen-full-experimental" , since_api = "4.6" ) ) ]
80+ #[ itest( focus) ]
81+ fn node_required_param_return ( ) {
82+ use godot:: classes:: Tween ;
83+ use godot:: obj:: Gd ;
84+
85+ let mut parent = Node :: new_alloc ( ) ;
86+ let child = Node :: new_alloc ( ) ;
87+
88+ // add_child() takes required arg, so this still works.
89+ // (Test for Option *not* working anymore is in godot > no_compile_tests.)
90+ parent. add_child ( & child) ;
91+
92+ // create_tween() returns now non-null instance.
93+ let tween: Gd < Tween > = parent. create_tween ( ) ;
94+ assert ! ( tween. is_instance_valid( ) ) ;
95+ assert ! ( tween. to_string( ) . contains( "Tween" ) ) ;
96+
97+ parent. free ( ) ;
98+ }
You can’t perform that action at this time.
0 commit comments