1
- use std:: mem:: ManuallyDrop ;
1
+ use std:: mem:: { ManuallyDrop , MaybeUninit } ;
2
2
use std:: ffi:: c_void;
3
3
use std:: alloc:: Layout ;
4
4
use std:: mem;
@@ -69,23 +69,23 @@ impl<Fmt: RawObjectFormat> SimpleMarkData<Fmt> {
69
69
pub struct SimpleMarkDataSnapshot < Fmt : RawObjectFormat > {
70
70
pub state : RawMarkState ,
71
71
#[ cfg( feature = "multiple-collectors" ) ]
72
- pub collector_id : CollectorId < Fmt >
72
+ pub collector_id_ptr : * mut CollectorId < Fmt >
73
73
}
74
74
impl < Fmt : RawObjectFormat > SimpleMarkDataSnapshot < Fmt > {
75
- pub fn new ( state : RawMarkState , collector_id : CollectorId < Fmt > ) -> Self {
75
+ pub fn new ( state : RawMarkState , collector_id_ptr : * mut CollectorId < Fmt > ) -> Self {
76
76
#[ cfg( feature = "multiple-collectors" ) ] {
77
- SimpleMarkDataSnapshot { state, collector_id }
77
+ SimpleMarkDataSnapshot { state, collector_id_ptr }
78
78
}
79
79
#[ cfg( not( feature = "multiple-collectors" ) ) ] {
80
- drop ( collector_id ) ; // avoid warnings
80
+ drop ( collector_id_ptr ) ; // avoid warnings
81
81
SimpleMarkDataSnapshot { state }
82
82
}
83
83
}
84
84
#[ inline]
85
85
fn packed ( & self ) -> usize {
86
86
let base: usize ;
87
87
#[ cfg( feature = "multiple-collectors" ) ] {
88
- base = self . collector_id . as_ref ( ) as * const RawSimpleCollector < Fmt > as usize ;
88
+ base = ( * self . collector_id_ptr ) . as_ref ( ) as * const RawSimpleCollector < Fmt > as usize ;
89
89
}
90
90
#[ cfg( not( feature = "multiple-collectors" ) ) ] {
91
91
base = 0 ;
@@ -98,8 +98,8 @@ impl<Fmt: RawObjectFormat> SimpleMarkDataSnapshot<Fmt> {
98
98
let state = MarkState :: from_byte ( ( packed & STATE_MASK ) as u8 ) ;
99
99
let id_bytes: usize = packed & !STATE_MASK ;
100
100
#[ cfg( feature="multiple-collectors" ) ] {
101
- let collector_id = CollectorId :: from_raw ( NonNull :: new_unchecked ( id_bytes) ) ;
102
- SimpleMarkDataSnapshot { state, collector_id }
101
+ let collector_id_ptr = id_bytes as * mut CollectorId < Fmt > ;
102
+ SimpleMarkDataSnapshot { state, collector_id_ptr }
103
103
}
104
104
#[ cfg( not( feature = "multiple-collectors" ) ) ] {
105
105
SimpleMarkDataSnapshot { state }
@@ -112,7 +112,7 @@ struct DynamicObj;
112
112
113
113
#[ repr( C ) ]
114
114
pub ( crate ) struct BigGcObject < Fmt : RawObjectFormat , T = DynamicObj > {
115
- pub ( crate ) header : Fmt :: SizedHeaderType ,
115
+ pub ( crate ) header : MaybeUninit < Fmt :: SizedHeaderType > ,
116
116
/// This is dropped using dynamic type info
117
117
pub ( crate ) static_value : ManuallyDrop < T >
118
118
}
0 commit comments