@@ -63,8 +63,12 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
6363
6464 out. extend ( quote ! {
6565 use core:: ops:: Deref ;
66- use core:: marker:: PhantomData ;
6766 } ) ;
67+ if !config. raw_access {
68+ out. extend ( quote ! {
69+ use core:: marker:: PhantomData ;
70+ } ) ;
71+ }
6872
6973 // Retaining the previous assumption
7074 let mut fpu_present = true ;
@@ -140,7 +144,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
140144 }
141145
142146 let generic_file = include_str ! ( "generic.rs" ) ;
143- let generic_reg_file = if config. raw_read_write {
147+ let generic_reg_file = if config. raw_access {
144148 include_str ! ( "generic_reg_raw.rs" )
145149 } else {
146150 include_str ! ( "generic_reg_vcell.rs" )
@@ -253,9 +257,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
253257 #feature_attribute
254258 pub #p_singleton: #p_ty,
255259 } ) ;
256- exprs. extend (
257- quote ! ( #feature_attribute #p_singleton: #p_ty { _marker: PhantomData } , ) ,
258- ) ;
260+ exprs. extend ( quote ! ( #feature_attribute #p_singleton: unsafe { #p_ty:: steal( ) } , ) ) ;
259261 }
260262 Peripheral :: Array ( p, dim_element) => {
261263 for p_name in names ( p, dim_element) {
@@ -271,7 +273,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
271273 pub #p_singleton: #p_ty,
272274 } ) ;
273275 exprs. extend (
274- quote ! ( #feature_attribute #p_singleton: #p_ty { _marker : PhantomData } , ) ,
276+ quote ! ( #feature_attribute #p_singleton: unsafe { #p_ty :: steal ( ) } , ) ,
275277 ) ;
276278 }
277279 }
0 commit comments