@@ -75,10 +75,10 @@ fn build_type<'a>(cx: &'a ExtCtxt, path: &Vec<String>,
75
75
let item = quote_item ! ( cx,
76
76
$doc_attr
77
77
#[ allow( non_camel_case_types) ]
78
- pub struct $name {
78
+ pub struct $name< ' a> {
79
79
value: $packed_ty,
80
80
mask: $packed_ty,
81
- reg: & ' static $reg_ty,
81
+ reg: & ' a $reg_ty,
82
82
}
83
83
) ;
84
84
item. unwrap ( )
@@ -92,7 +92,7 @@ fn build_new<'a>(cx: &'a ExtCtxt, path: &Vec<String>)
92
92
utils:: setter_name ( cx, path) ) ;
93
93
let item = quote_item ! ( cx,
94
94
#[ 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 {
96
96
$setter_ty {
97
97
value: 0 ,
98
98
mask: 0 ,
@@ -125,7 +125,7 @@ fn build_drop<'a>(cx: &'a ExtCtxt, path: &Vec<String>,
125
125
let item = quote_item ! ( cx,
126
126
#[ unsafe_destructor]
127
127
#[ doc = "This performs the register update" ]
128
- impl Drop for $setter_ty {
128
+ impl < ' a> Drop for $setter_ty< ' a> {
129
129
fn drop( & mut self ) {
130
130
let clear_mask: $unpacked_ty = $clear as $unpacked_ty;
131
131
if self . mask != 0 {
@@ -161,7 +161,7 @@ fn build_impl<'a>(cx: &'a ExtCtxt, path: &Vec<String>, reg: &node::Reg,
161
161
let done: P < ast:: Method > = build_done ( cx) ;
162
162
let impl_ = quote_item ! ( cx,
163
163
#[ allow( dead_code) ]
164
- impl $setter_ty {
164
+ impl < ' a> $setter_ty< ' a> {
165
165
$new
166
166
$methods
167
167
$done
@@ -206,8 +206,8 @@ fn build_field_set_fn<'a>(cx: &'a ExtCtxt, path: &Vec<String>, reg: &node::Reg,
206
206
let shift = utils:: shift ( cx, None , field) ;
207
207
quote_method ! ( cx,
208
208
$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> {
211
211
self . value |= ( self . value & ! $mask) | ( ( new_value as $unpacked_ty) & $mask) << $shift;
212
212
self . mask |= $mask << $shift;
213
213
self
@@ -217,11 +217,11 @@ fn build_field_set_fn<'a>(cx: &'a ExtCtxt, path: &Vec<String>, reg: &node::Reg,
217
217
let shift = utils:: shift ( cx, Some ( quote_expr ! ( cx, idx) ) , field) ;
218
218
quote_method ! ( cx,
219
219
$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
225
225
}
226
226
)
227
227
}
@@ -248,21 +248,20 @@ fn build_field_clear_fn<'a>(cx: &'a ExtCtxt, path: &Vec<String>,
248
248
let shift = utils:: shift ( cx, None , field) ;
249
249
quote_method ! ( cx,
250
250
$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
255
255
}
256
256
)
257
257
} else {
258
258
let shift = utils:: shift ( cx, Some ( quote_expr ! ( cx, idx) ) , field) ;
259
259
quote_method ! ( cx,
260
260
$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
266
265
}
267
266
)
268
267
}
0 commit comments