@@ -261,7 +261,8 @@ impl<T: GodotClass> RawGd<T> {
261
261
/// Bounds should be added on user-facing safe APIs.
262
262
pub ( super ) unsafe fn as_upcast_ref < Base > ( & self ) -> & Base
263
263
where
264
- Base : GodotClass ,
264
+ // DeclEngine needed for sound transmute; in case we add Rust-defined base classes.
265
+ Base : GodotClass + Bounds < Declarer = bounds:: DeclEngine > ,
265
266
{
266
267
self . ensure_valid_upcast :: < Base > ( ) ;
267
268
@@ -299,7 +300,8 @@ impl<T: GodotClass> RawGd<T> {
299
300
/// Bounds should be added on user-facing safe APIs.
300
301
pub ( super ) unsafe fn as_upcast_mut < Base > ( & mut self ) -> & mut Base
301
302
where
302
- Base : GodotClass ,
303
+ // DeclEngine needed for sound transmute; in case we add Rust-defined base classes.
304
+ Base : GodotClass + Bounds < Declarer = bounds:: DeclEngine > ,
303
305
{
304
306
self . ensure_valid_upcast :: < Base > ( ) ;
305
307
@@ -315,7 +317,10 @@ impl<T: GodotClass> RawGd<T> {
315
317
316
318
/// # Panics
317
319
/// If this `RawGd` is null.
318
- pub ( super ) fn as_target ( & self ) -> & GdDerefTarget < T > {
320
+ pub ( super ) fn as_target ( & self ) -> & GdDerefTarget < T >
321
+ where
322
+ GdDerefTarget < T > : Bounds < Declarer = bounds:: DeclEngine > ,
323
+ {
319
324
// SAFETY: There are two possible Declarer::DerefTarget types:
320
325
// - T, if T is an engine class
321
326
// - T::Base, if T is a user class
@@ -325,7 +330,10 @@ impl<T: GodotClass> RawGd<T> {
325
330
326
331
/// # Panics
327
332
/// If this `RawGd` is null.
328
- pub ( super ) fn as_target_mut ( & mut self ) -> & mut GdDerefTarget < T > {
333
+ pub ( super ) fn as_target_mut ( & mut self ) -> & mut GdDerefTarget < T >
334
+ where
335
+ GdDerefTarget < T > : Bounds < Declarer = bounds:: DeclEngine > ,
336
+ {
329
337
// SAFETY: See as_target().
330
338
unsafe { self . as_upcast_mut :: < GdDerefTarget < T > > ( ) }
331
339
}
0 commit comments