File tree Expand file tree Collapse file tree 3 files changed +340
-416
lines changed
objc2/src/__macro_helpers
test-assembly/crates/test_declare_class/expected Expand file tree Collapse file tree 3 files changed +340
-416
lines changed Original file line number Diff line number Diff line change @@ -281,8 +281,14 @@ pub(crate) fn register_with_ivars<T: DeclaredClass>(
281
281
let cls = builder. register ( ) ;
282
282
283
283
let ivars_offset = if T :: HAS_IVARS {
284
+ // Monomorphized error handling
285
+ // Intentionally not #[track_caller], we expect this error to never occur
286
+ fn get_ivar_failed ( ) -> ! {
287
+ unreachable ! ( "failed retrieving instance variable on newly declared class" )
288
+ }
289
+
284
290
cls. instance_variable ( & ivar_name)
285
- . expect ( "failed retrieving instance variable on newly declared class" )
291
+ . unwrap_or_else ( || get_ivar_failed ( ) )
286
292
. offset ( )
287
293
} else {
288
294
// Fallback to an offset of zero.
@@ -293,8 +299,14 @@ pub(crate) fn register_with_ivars<T: DeclaredClass>(
293
299
} ;
294
300
295
301
let drop_flag_offset = if T :: HAS_DROP_FLAG {
302
+ // Monomorphized error handling
303
+ // Intentionally not #[track_caller], we expect this error to never occur
304
+ fn get_drop_flag_failed ( ) -> ! {
305
+ unreachable ! ( "failed retrieving drop flag instance variable on newly declared class" )
306
+ }
307
+
296
308
cls. instance_variable ( & drop_flag_name)
297
- . expect ( "failed retrieving drop flag instance variable on newly declared class" )
309
+ . unwrap_or_else ( || get_drop_flag_failed ( ) )
298
310
. offset ( )
299
311
} else {
300
312
// Fall back to an offset of zero.
You can’t perform that action at this time.
0 commit comments