File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -383,13 +383,10 @@ impl Page {
383
383
384
384
#[ inline]
385
385
fn assert_type < T : Slot > ( & self ) -> PageView < ' _ , T > {
386
- assert_eq ! (
387
- self . slot_type_id,
388
- TypeId :: of:: <T >( ) ,
389
- "page has slot type `{:?}` but `{:?}` was expected" ,
390
- self . slot_type_name,
391
- std:: any:: type_name:: <T >( ) ,
392
- ) ;
386
+ if self . slot_type_id != TypeId :: of :: < T > ( ) {
387
+ type_assert_failed :: < T > ( self ) ;
388
+ }
389
+
393
390
PageView ( self , PhantomData )
394
391
}
395
392
@@ -403,6 +400,17 @@ impl Page {
403
400
}
404
401
}
405
402
403
+ /// This function is explicitly outlined to avoid debug machinery in the hot-path.
404
+ #[ cold]
405
+ #[ inline( never) ]
406
+ fn type_assert_failed < T : ' static > ( page : & Page ) -> ! {
407
+ panic ! (
408
+ "page has slot type `{:?}` but `{:?}` was expected" ,
409
+ page. slot_type_name,
410
+ std:: any:: type_name:: <T >( ) ,
411
+ )
412
+ }
413
+
406
414
impl Drop for Page {
407
415
fn drop ( & mut self ) {
408
416
let len = * self . allocated . get_mut ( ) ;
You can’t perform that action at this time.
0 commit comments