@@ -77,7 +77,6 @@ use parse::token;
77
77
use parse:: { new_sub_parser_from_file, ParseSess } ;
78
78
use owned_slice:: OwnedSlice ;
79
79
80
- use std:: cell:: Cell ;
81
80
use collections:: HashSet ;
82
81
use std:: kinds:: marker;
83
82
use std:: mem:: replace;
@@ -2202,12 +2201,12 @@ impl<'a> Parser<'a> {
2202
2201
// unification of Matcher's and TokenTree's would vastly improve
2203
2202
// the interpolation of Matcher's
2204
2203
maybe_whole ! ( self , NtMatchers ) ;
2205
- let name_idx = @ Cell :: new ( 0 u ) ;
2204
+ let mut name_idx = 0 u ;
2206
2205
match self . token {
2207
2206
token:: LBRACE | token:: LPAREN | token:: LBRACKET => {
2208
2207
let other_delimiter = token:: flip_delimiter ( & self . token ) ;
2209
2208
self . bump ( ) ;
2210
- self . parse_matcher_subseq_upto ( name_idx, & other_delimiter)
2209
+ self . parse_matcher_subseq_upto ( & mut name_idx, & other_delimiter)
2211
2210
}
2212
2211
_ => self . fatal ( "expected open delimiter" )
2213
2212
}
@@ -2217,7 +2216,7 @@ impl<'a> Parser<'a> {
2217
2216
// Otherwise, `$( ( )` would be a valid Matcher, and `$( () )` would be
2218
2217
// invalid. It's similar to common::parse_seq.
2219
2218
pub fn parse_matcher_subseq_upto ( & mut self ,
2220
- name_idx : @ Cell < uint > ,
2219
+ name_idx : & mut uint ,
2221
2220
ket : & token:: Token )
2222
2221
-> Vec < Matcher > {
2223
2222
let mut ret_val = Vec :: new ( ) ;
@@ -2234,27 +2233,27 @@ impl<'a> Parser<'a> {
2234
2233
return ret_val;
2235
2234
}
2236
2235
2237
- pub fn parse_matcher ( & mut self , name_idx : @ Cell < uint > ) -> Matcher {
2236
+ pub fn parse_matcher ( & mut self , name_idx : & mut uint ) -> Matcher {
2238
2237
let lo = self . span . lo ;
2239
2238
2240
2239
let m = if self . token == token:: DOLLAR {
2241
2240
self . bump ( ) ;
2242
2241
if self . token == token:: LPAREN {
2243
- let name_idx_lo = name_idx. get ( ) ;
2242
+ let name_idx_lo = * name_idx;
2244
2243
self . bump ( ) ;
2245
2244
let ms = self . parse_matcher_subseq_upto ( name_idx,
2246
2245
& token:: RPAREN ) ;
2247
2246
if ms. len ( ) == 0 u {
2248
2247
self . fatal ( "repetition body must be nonempty" ) ;
2249
2248
}
2250
2249
let ( sep, zerok) = self . parse_sep_and_zerok ( ) ;
2251
- MatchSeq ( ms, sep, zerok, name_idx_lo, name_idx. get ( ) )
2250
+ MatchSeq ( ms, sep, zerok, name_idx_lo, * name_idx)
2252
2251
} else {
2253
2252
let bound_to = self . parse_ident ( ) ;
2254
2253
self . expect ( & token:: COLON ) ;
2255
2254
let nt_name = self . parse_ident ( ) ;
2256
- let m = MatchNonterminal ( bound_to, nt_name, name_idx. get ( ) ) ;
2257
- name_idx. set ( name_idx . get ( ) + 1 u ) ;
2255
+ let m = MatchNonterminal ( bound_to, nt_name, * name_idx) ;
2256
+ * name_idx += 1 ;
2258
2257
m
2259
2258
}
2260
2259
} else {
0 commit comments