Skip to content

Commit

Permalink
Merge #1055
Browse files Browse the repository at this point in the history
1055: Fix CI errors r=chitoyuu a=chitoyuu



Co-authored-by: Chitose Yuuzaki <[email protected]>
  • Loading branch information
bors[bot] and chitoyuu authored Sep 24, 2023
2 parents 1c6b364 + 3f4c27c commit cfa763a
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 26 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"gdnative",
"gdnative-async",
Expand Down
2 changes: 1 addition & 1 deletion bindings-generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ heck = "0.4"
miniserde = "0.1.16"
proc-macro2 = "1"
quote = "1"
regex = { version = "1.5.5", default-features = false, features = ["std"] } # for security: https://blog.rust-lang.org/2022/03/08/cve-2022-24713.html
regex = { version = "1.5.5", default-features = false, features = ["std", "unicode-perl"] } # for security: https://blog.rust-lang.org/2022/03/08/cve-2022-24713.html
roxmltree = "0.18"
syn = { version = "1", features = ["full", "extra-traits", "visit"] }
unindent = "0.2.0"
Expand Down
2 changes: 1 addition & 1 deletion bindings-generator/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl core::cmp::Ord for Enum {

impl core::cmp::PartialOrd for Enum {
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
core::cmp::PartialOrd::partial_cmp(&self.name, &other.name)
Some(self.cmp(other))
}
}

Expand Down
1 change: 1 addition & 0 deletions gdnative-async/src/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ impl<'a, C: NativeClass, A> Spawner<'a, C, A> {
/// Consumes this `Spawner` and spawns a future returned by the closure. This indirection
/// is necessary so that implementors of the `AsyncMethod` trait do not have to name their
/// future types.
#[allow(clippy::arc_with_non_send_sync)] // Stability concerns: part of public API
pub fn spawn<F, R>(self, f: F)
where
F: FnOnce(Arc<Context>, TInstance<'_, C>, A) -> R,
Expand Down
2 changes: 1 addition & 1 deletion gdnative-bindings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![allow(non_snake_case)]
#![allow(unused_unsafe)]
// False positives on generated drops that enforce lifetime
#![allow(clippy::drop_copy)]
#![allow(dropping_copy_types)]
// False positives on thread-safe singletons
#![allow(clippy::non_send_fields_in_send_ty)]
// Disable non-critical lints for generated code
Expand Down
6 changes: 3 additions & 3 deletions gdnative-core/src/export/class_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ pub(crate) fn types_with_init_level(allow: InitLevel, deny: InitLevel) -> Vec<Co
let registry = CLASS_REGISTRY.read();
let mut list = registry
.values()
.filter_map(|class_info| {
(class_info.init_level.intersects(allow) && !class_info.init_level.intersects(deny))
.then(|| class_info.name.clone())
.filter(|class_info| {
class_info.init_level.intersects(allow) && !class_info.init_level.intersects(deny)
})
.map(|class_info| class_info.name.clone())
.collect::<Vec<_>>();

list.sort_unstable();
Expand Down
2 changes: 1 addition & 1 deletion gdnative-core/src/export/emplace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn take<T: NativeClass>() -> Option<T> {
Err(any) => panic!(
"expecting {} in the emplacement cell, got {:?} (this is a bug in the bindings)",
class_registry::class_name_or_default::<T>(),
any.type_id(),
(*any).type_id(),
),
})
}
4 changes: 2 additions & 2 deletions gdnative-core/src/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ impl<T: GodotObject, Own: Ownership> Ord for Ref<T, Own> {
impl<T: GodotObject, Own: Ownership> PartialOrd for Ref<T, Own> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.ptr.as_non_null().partial_cmp(&other.ptr.as_non_null())
Some(self.cmp(other))
}
}

Expand Down Expand Up @@ -863,7 +863,7 @@ impl<'a, T: GodotObject, Own: Ownership> Copy for TRef<'a, T, Own> {}
impl<'a, T: GodotObject, Own: Ownership> Clone for TRef<'a, T, Own> {
#[inline]
fn clone(&self) -> Self {
TRef::new(self.obj)
*self
}
}

Expand Down
10 changes: 5 additions & 5 deletions gdnative-core/src/object/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl<T: GodotObject> RawObject<T> {
pub fn class_name(&self) -> String {
let api = crate::private::get_api();
let get_class_method = crate::private::ObjectMethodTable::get(api).get_class;
let mut argument_buffer = [ptr::null() as *const libc::c_void; 0];
let mut argument_buffer: [*const libc::c_void; 0] = [];
let mut class_name = sys::godot_string::default();
let ret_ptr = &mut class_name as *mut sys::godot_string;

Expand Down Expand Up @@ -127,7 +127,7 @@ impl<T: GodotObject<Memory = RefCounted>> RawObject<T> {
pub fn add_ref(&self) {
let api = crate::private::get_api();
let addref_method = crate::private::ReferenceMethodTable::get(api).reference;
let mut argument_buffer = [ptr::null() as *const libc::c_void; 0];
let mut argument_buffer: [*const libc::c_void; 0] = [];
let mut ok = false;
let ok_ptr = &mut ok as *mut bool;

Expand Down Expand Up @@ -158,7 +158,7 @@ impl<T: GodotObject<Memory = RefCounted>> RawObject<T> {
let api = crate::private::get_api();
let unref_method = crate::private::ReferenceMethodTable::get(api).unreference;

let mut argument_buffer = [ptr::null() as *const libc::c_void; 0];
let mut argument_buffer: [*const libc::c_void; 0] = [];
let mut last_reference = false;
let ret_ptr = &mut last_reference as *mut bool;
(api.godot_method_bind_ptrcall)(
Expand Down Expand Up @@ -201,7 +201,7 @@ impl<T: GodotObject<Memory = RefCounted>> RawObject<T> {
let api = crate::private::get_api();
let init_method = crate::private::ReferenceMethodTable::get(api).init_ref;

let mut argument_buffer = [ptr::null() as *const libc::c_void; 0];
let mut argument_buffer: [*const libc::c_void; 0] = [];
let mut ok = false;
let ret_ptr = &mut ok as *mut bool;
(api.godot_method_bind_ptrcall)(
Expand Down Expand Up @@ -237,7 +237,7 @@ unsafe fn ptr_is_class(obj: *mut sys::godot_object, class_name: &str) -> bool {
class_name.len() as _,
);

let mut argument_buffer = [ptr::null() as *const libc::c_void; 1];
let mut argument_buffer: [*const libc::c_void; 1] = [ptr::null(); 1];
argument_buffer[0] = (&class_name) as *const _ as *const _;

let mut ret = false;
Expand Down
3 changes: 1 addition & 2 deletions gdnative-derive/src/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,7 @@ fn impl_gdnative_expose(ast: ItemImpl) -> (ItemImpl, ClassMethodExport) {

if is_export {
use syn::{punctuated::Punctuated, Lit};
let mut export_args =
export_args.get_or_insert_with(ExportArgs::default);
let export_args = export_args.get_or_insert_with(ExportArgs::default);
export_args.is_old_syntax = is_old_syntax;

// Codes like #[macro(path, name = "value")] are accepted.
Expand Down
4 changes: 2 additions & 2 deletions gdnative/tests/ui/derive_fail_methods_special_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ impl Foo {
}

#[method]
async fn optional(#[opt] self, #[base] #[opt] _base: &Node, #[async_ctx] #[opt] ctx: ()) {}
async fn optional(#[opt] self, #[base] #[opt] _base: &Node, #[async_ctx] #[opt] _ctx: ()) {}

#[method]
fn based(#[base] self, #[base] _base: &Node, #[base] #[base] _basil: &Node, #[base] #[base] #[base] _basin: &Node) {}

#[method]
fn sync(self, #[async_ctx] ctx: ()) {}
fn sync(self, #[async_ctx] _ctx: ()) {}
}

fn main() {}
10 changes: 5 additions & 5 deletions gdnative/tests/ui/derive_fail_methods_special_args.stderr
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
error: the method receiver cannot be optional (instead, remove the argument entirely)
--> tests/ui/derive_fail_methods_special_args.rs:14:25
|
14 | async fn optional(#[opt] self, #[base] #[opt] _base: &Node, #[async_ctx] #[opt] ctx: ()) {}
14 | async fn optional(#[opt] self, #[base] #[opt] _base: &Node, #[async_ctx] #[opt] _ctx: ()) {}
| ^^^

error: the base/owner object cannot be optional (instead, remove the argument entirely)
--> tests/ui/derive_fail_methods_special_args.rs:14:46
|
14 | async fn optional(#[opt] self, #[base] #[opt] _base: &Node, #[async_ctx] #[opt] ctx: ()) {}
14 | async fn optional(#[opt] self, #[base] #[opt] _base: &Node, #[async_ctx] #[opt] _ctx: ()) {}
| ^^^

error: the async context cannot be optional (instead, remove the argument entirely)
--> tests/ui/derive_fail_methods_special_args.rs:14:80
|
14 | async fn optional(#[opt] self, #[base] #[opt] _base: &Node, #[async_ctx] #[opt] ctx: ()) {}
14 | async fn optional(#[opt] self, #[base] #[opt] _base: &Node, #[async_ctx] #[opt] _ctx: ()) {}
| ^^^

error: the method receiver cannot also be the base/owner object
Expand Down Expand Up @@ -55,5 +55,5 @@ error: the special parameter base/owner object must only be declared once (the s
error: the async context is only available to async methods
--> tests/ui/derive_fail_methods_special_args.rs:20:32
|
20 | fn sync(self, #[async_ctx] ctx: ()) {}
| ^^^
20 | fn sync(self, #[async_ctx] _ctx: ()) {}
| ^^^^
4 changes: 2 additions & 2 deletions gdnative/tests/ui/derive_flexible_self_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ impl Foo {
fn arc(self: Arc<Self>) {}

#[method]
fn instance(#[self] this: Instance<Self>) {}
fn instance(#[self] _this: Instance<Self>) {}

#[method]
fn t_instance(#[self] this: TInstance<Self>) {}
fn t_instance(#[self] _this: TInstance<Self>) {}
}

fn main() {}
2 changes: 1 addition & 1 deletion tools/required-errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Empty lines or lines that start with '#' are ignored.

# test_array_debug
4,thread '[^']*' panicked at 'Index 3 out of bounds (len 3)'
4,Index 3 out of bounds (len 3)

# test_derive_nativeclass_property_with_only_getter
1,ERROR: \(<unset>: \)\?property size on native class MyVec does not have a setter
Expand Down

0 comments on commit cfa763a

Please sign in to comment.