Skip to content

Commit f1d36b5

Browse files
bors[bot]chitoyuu
andauthored
Merge #1013
1013: Impl invalid accessors for inconvertible types r=chitoyuu a=chitoyuu The invalid accessors used to require conversion traits for the property types. This prevented users from registering read-only properties of types that only implement `ToVariant`. Co-authored-by: Chitose Yuuzaki <chitoyuu@potatoes.gay>
2 parents 56fbb4c + f89f90b commit f1d36b5

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

.github/composite/godot/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,25 @@ runs:
6262
cd test;
6363
mkdir -p ./project/lib;
6464
cp ../target/debug/libgdnative_test.so ./project/lib/;
65-
${GODOT_BIN} --path ./project/ > >(tee "${{ runner.temp }}/stdout.log") 2> >(tee "${{ runner.temp }}/stderr.log");
65+
${GODOT_BIN} --verbose --path ./project/ > >(tee "${{ runner.temp }}/stdout.log") 2> >(tee "${{ runner.temp }}/stderr.log");
6666
bash ../tools/check-test-output.sh "${{ runner.temp }}/stdout.log" "${{ runner.temp }}/stderr.log";
6767
if [[ $? -ne 0 ]]; then
6868
exit 1;
6969
fi;
70-
${GODOT_BIN} -e --path ./project/ --run-editor-tests > >(tee "${{ runner.temp }}/stdout.log") 2> >(tee "${{ runner.temp }}/stderr.log");
70+
${GODOT_BIN} --verbose -e --path ./project/ --run-editor-tests > >(tee "${{ runner.temp }}/stdout.log") 2> >(tee "${{ runner.temp }}/stderr.log");
7171
bash ../tools/check-test-output.sh "${{ runner.temp }}/stdout.log" "${{ runner.temp }}/stderr.log";
7272
if [[ $? -ne 0 ]]; then
7373
exit 1;
7474
fi;
7575
cargo build --features type-tag-fallback ${{ inputs.rust_extra_args }}
7676
mkdir -p ./project/lib;
7777
cp ../target/debug/libgdnative_test.so ./project/lib/;
78-
${GODOT_BIN} --path ./project/ > >(tee "${{ runner.temp }}/stdout.log") 2> >(tee "${{ runner.temp }}/stderr.log");
78+
${GODOT_BIN} --verbose --path ./project/ > >(tee "${{ runner.temp }}/stdout.log") 2> >(tee "${{ runner.temp }}/stderr.log");
7979
bash ../tools/check-test-output.sh "${{ runner.temp }}/stdout.log" "${{ runner.temp }}/stderr.log";
8080
if [[ $? -ne 0 ]]; then
8181
exit 1;
8282
fi;
83-
${GODOT_BIN} -e --path ./project/ --run-editor-tests > >(tee "${{ runner.temp }}/stdout.log") 2> >(tee "${{ runner.temp }}/stderr.log");
83+
${GODOT_BIN} --verbose -e --path ./project/ --run-editor-tests > >(tee "${{ runner.temp }}/stdout.log") 2> >(tee "${{ runner.temp }}/stderr.log");
8484
bash ../tools/check-test-output.sh "${{ runner.temp }}/stdout.log" "${{ runner.temp }}/stderr.log";
8585
if [[ $? -ne 0 ]]; then
8686
exit 1;

gdnative-core/src/export/property/invalid_accessor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use std::mem;
44

5-
use crate::core_types::{FromVariant, ToVariant, Variant};
5+
use crate::core_types::Variant;
66
use crate::export::{class_registry, NativeClass};
77

88
use super::accessor::{RawGetter, RawSetter};
@@ -78,7 +78,7 @@ extern "C" fn invalid_free_func(data: *mut libc::c_void) {
7878
mem::drop(data)
7979
}
8080

81-
unsafe impl<'l, C: NativeClass, T: FromVariant> RawSetter<C, T> for InvalidSetter<'l> {
81+
unsafe impl<'l, C: NativeClass, T> RawSetter<C, T> for InvalidSetter<'l> {
8282
#[inline]
8383
unsafe fn into_godot_function(self) -> sys::godot_property_set_func {
8484
let mut set = sys::godot_property_set_func::default();
@@ -95,7 +95,7 @@ unsafe impl<'l, C: NativeClass, T: FromVariant> RawSetter<C, T> for InvalidSette
9595
}
9696
}
9797

98-
unsafe impl<'l, C: NativeClass, T: ToVariant> RawGetter<C, T> for InvalidGetter<'l> {
98+
unsafe impl<'l, C: NativeClass, T> RawGetter<C, T> for InvalidGetter<'l> {
9999
#[inline]
100100
unsafe fn into_godot_function(self) -> sys::godot_property_get_func {
101101
let mut get = sys::godot_property_get_func::default();

test/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ godot_itest! {
104104
// Should not panic due to conversion failure
105105
let option = node.get_node("does not exist");
106106
assert!(option.is_none());
107+
node.free();
107108
}
108109
}
109110

0 commit comments

Comments
 (0)