@@ -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 ,
@@ -125,7 +125,7 @@ fn build_drop<'a>(cx: &'a ExtCtxt, path: &Vec<String>,
125125 let item = quote_item ! ( cx,
126126 #[ unsafe_destructor]
127127 #[ doc = "This performs the register update" ]
128- impl Drop for $setter_ty {
128+ impl < ' a> Drop for $setter_ty< ' a> {
129129 fn drop( & mut self ) {
130130 let clear_mask: $unpacked_ty = $clear as $unpacked_ty;
131131 if self . mask != 0 {
@@ -161,7 +161,7 @@ fn build_impl<'a>(cx: &'a ExtCtxt, path: &Vec<String>, reg: &node::Reg,
161161 let done: P < ast:: Method > = build_done ( cx) ;
162162 let impl_ = quote_item ! ( cx,
163163 #[ allow( dead_code) ]
164- impl $setter_ty {
164+ impl < ' a> $setter_ty< ' a> {
165165 $new
166166 $methods
167167 $done
@@ -206,8 +206,8 @@ fn build_field_set_fn<'a>(cx: &'a ExtCtxt, path: &Vec<String>, reg: &node::Reg,
206206 let shift = utils:: shift ( cx, None , field) ;
207207 quote_method ! ( cx,
208208 $doc_attr
209- pub fn $fn_name<' a >( & ' a mut self , new_value: $field_ty)
210- -> & ' a mut $setter_ty {
209+ pub fn $fn_name<' b >( & ' b mut self , new_value: $field_ty)
210+ -> & ' b mut $setter_ty< ' a> {
211211 self . value |= ( self . value & ! $mask) | ( ( new_value as $unpacked_ty) & $mask) << $shift;
212212 self . mask |= $mask << $shift;
213213 self
@@ -217,11 +217,11 @@ fn build_field_set_fn<'a>(cx: &'a ExtCtxt, path: &Vec<String>, reg: &node::Reg,
217217 let shift = utils:: shift ( cx, Some ( quote_expr ! ( cx, idx) ) , field) ;
218218 quote_method ! ( cx,
219219 $doc_attr
220- pub fn $fn_name<' a >( & ' a mut self , idx: uint, new_value: $field_ty)
221- -> & ' a mut $setter_ty {
222- self . value |= ( self . value & ! $mask) | ( ( new_value as $unpacked_ty) & $mask) << $shift;
223- self . mask |= $mask << $shift;
224- self
220+ pub fn $fn_name<' b >( & ' b mut self , idx: uint, new_value: $field_ty)
221+ -> & ' b mut $setter_ty< ' a> {
222+ self . value |= ( self . value & ! $mask) | ( ( new_value as $unpacked_ty) & $mask) << $shift;
223+ self . mask |= $mask << $shift;
224+ self
225225 }
226226 )
227227 }
@@ -248,21 +248,20 @@ fn build_field_clear_fn<'a>(cx: &'a ExtCtxt, path: &Vec<String>,
248248 let shift = utils:: shift ( cx, None , field) ;
249249 quote_method ! ( cx,
250250 $doc_attr
251- pub fn $fn_name<' a >( & ' a mut self ) -> & ' a mut $setter_ty {
252- self . value |= $mask << $shift;
253- self . mask |= $mask << $shift;
254- self
251+ pub fn $fn_name<' b >( & ' b mut self ) -> & ' b mut $setter_ty< ' a> {
252+ self . value |= $mask << $shift;
253+ self . mask |= $mask << $shift;
254+ self
255255 }
256256 )
257257 } else {
258258 let shift = utils:: shift ( cx, Some ( quote_expr ! ( cx, idx) ) , field) ;
259259 quote_method ! ( cx,
260260 $doc_attr
261- pub fn $fn_name<' a>( & ' a mut self , idx: uint)
262- -> & ' a mut $setter_ty {
263- self . value |= $mask << $shift;
264- self . mask |= $mask << $shift;
265- self
261+ pub fn $fn_name<' b>( & ' b mut self , idx: uint) -> & ' b mut $setter_ty<' a> {
262+ self . value |= $mask << $shift;
263+ self . mask |= $mask << $shift;
264+ self
266265 }
267266 )
268267 }
0 commit comments