@@ -75,10 +75,10 @@ fn build_type<'a>(cx: &'a ExtCtxt, path: &Vec<String>,
7575 let item = quote_item ! ( cx,
7676 $doc_attr
7777 #[ allow( non_camel_case_types) ]
78- pub struct $name {
78+ pub struct $name< ' a> {
7979 value: $packed_ty,
8080 mask: $packed_ty,
81- reg: & ' static $reg_ty,
81+ reg: & ' a $reg_ty,
8282 }
8383 ) ;
8484 item. unwrap ( )
@@ -92,7 +92,7 @@ fn build_new<'a>(cx: &'a ExtCtxt, path: &Vec<String>)
9292 utils:: setter_name ( cx, path) ) ;
9393 let item = quote_item ! ( cx,
9494 #[ doc="Create a new updater" ]
95- pub fn new( reg: & ' static $reg_ty) -> $setter_ty {
95+ pub fn new( reg: & ' a $reg_ty) -> $setter_ty {
9696 $setter_ty {
9797 value: 0 ,
9898 mask: 0 ,
@@ -134,7 +134,7 @@ fn build_drop<'a>(cx: &'a ExtCtxt, path: &Vec<String>,
134134 let item = quote_item ! ( cx,
135135 #[ unsafe_destructor]
136136 #[ doc = "This performs the register update" ]
137- impl Drop for $setter_ty {
137+ impl < ' a> Drop for $setter_ty< ' a> {
138138 fn drop( & mut self ) {
139139 let clear_mask: $unpacked_ty = $clear as $unpacked_ty;
140140 if self . mask != 0 {
@@ -170,7 +170,7 @@ fn build_impl<'a>(cx: &'a ExtCtxt, path: &Vec<String>, reg: &node::Reg,
170170 let done: P < ast:: Method > = build_done ( cx) ;
171171 let impl_ = quote_item ! ( cx,
172172 #[ allow( dead_code) ]
173- impl $setter_ty {
173+ impl < ' a> $setter_ty< ' a> {
174174 $new
175175 $methods
176176 $done
@@ -215,8 +215,8 @@ fn build_field_set_fn<'a>(cx: &'a ExtCtxt, path: &Vec<String>, reg: &node::Reg,
215215 let shift = utils:: shift ( cx, None , field) ;
216216 quote_method ! ( cx,
217217 $doc_attr
218- pub fn $fn_name<' a >( & ' a mut self , new_value: $field_ty)
219- -> & ' a mut $setter_ty {
218+ pub fn $fn_name<' b >( & ' b mut self , new_value: $field_ty)
219+ -> & ' b mut $setter_ty< ' a> {
220220 self . value |= ( self . value & ! $mask) | ( ( new_value as $unpacked_ty) & $mask) << $shift;
221221 self . mask |= $mask << $shift;
222222 self
@@ -226,11 +226,11 @@ fn build_field_set_fn<'a>(cx: &'a ExtCtxt, path: &Vec<String>, reg: &node::Reg,
226226 let shift = utils:: shift ( cx, Some ( quote_expr ! ( cx, idx) ) , field) ;
227227 quote_method ! ( cx,
228228 $doc_attr
229- pub fn $fn_name<' a >( & ' a mut self , idx: uint, new_value: $field_ty)
230- -> & ' a mut $setter_ty {
231- self . value |= ( self . value & ! $mask) | ( ( new_value as $unpacked_ty) & $mask) << $shift;
232- self . mask |= $mask << $shift;
233- self
229+ pub fn $fn_name<' b >( & ' b mut self , idx: uint, new_value: $field_ty)
230+ -> & ' b mut $setter_ty< ' a> {
231+ self . value |= ( self . value & ! $mask) | ( ( new_value as $unpacked_ty) & $mask) << $shift;
232+ self . mask |= $mask << $shift;
233+ self
234234 }
235235 )
236236 }
@@ -257,21 +257,20 @@ fn build_field_clear_fn<'a>(cx: &'a ExtCtxt, path: &Vec<String>,
257257 let shift = utils:: shift ( cx, None , field) ;
258258 quote_method ! ( cx,
259259 $doc_attr
260- pub fn $fn_name<' a >( & ' a mut self ) -> & ' a mut $setter_ty {
261- self . value |= $mask << $shift;
262- self . mask |= $mask << $shift;
263- self
260+ pub fn $fn_name<' b >( & ' b mut self ) -> & ' b mut $setter_ty< ' a> {
261+ self . value |= $mask << $shift;
262+ self . mask |= $mask << $shift;
263+ self
264264 }
265265 )
266266 } else {
267267 let shift = utils:: shift ( cx, Some ( quote_expr ! ( cx, idx) ) , field) ;
268268 quote_method ! ( cx,
269269 $doc_attr
270- pub fn $fn_name<' a>( & ' a mut self , idx: uint)
271- -> & ' a mut $setter_ty {
272- self . value |= $mask << $shift;
273- self . mask |= $mask << $shift;
274- self
270+ pub fn $fn_name<' b>( & ' b mut self , idx: uint) -> & ' b mut $setter_ty<' a> {
271+ self . value |= $mask << $shift;
272+ self . mask |= $mask << $shift;
273+ self
275274 }
276275 )
277276 }
0 commit comments