Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of @Cell #13085

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ struct DynamicFailureHandler<'a> {
bcx: &'a Block<'a>,
sp: Span,
msg: InternedString,
finished: @Cell<Option<BasicBlockRef>>,
finished: Cell<Option<BasicBlockRef>>,
}

impl<'a> DynamicFailureHandler<'a> {
Expand Down Expand Up @@ -1927,7 +1927,7 @@ fn trans_match_inner<'a>(scope_cx: &'a Block<'a>,
let chk = {
if ty::type_is_empty(tcx, t) {
// Special case for empty types
let fail_cx = @Cell::new(None);
let fail_cx = Cell::new(None);
let fail_handler = ~DynamicFailureHandler {
bcx: scope_cx,
sp: discr_expr.span,
Expand Down
17 changes: 8 additions & 9 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ use parse::token;
use parse::{new_sub_parser_from_file, ParseSess};
use owned_slice::OwnedSlice;

use std::cell::Cell;
use collections::HashSet;
use std::kinds::marker;
use std::mem::replace;
Expand Down Expand Up @@ -2202,12 +2201,12 @@ impl<'a> Parser<'a> {
// unification of Matcher's and TokenTree's would vastly improve
// the interpolation of Matcher's
maybe_whole!(self, NtMatchers);
let name_idx = @Cell::new(0u);
let mut name_idx = 0u;
match self.token {
token::LBRACE | token::LPAREN | token::LBRACKET => {
let other_delimiter = token::flip_delimiter(&self.token);
self.bump();
self.parse_matcher_subseq_upto(name_idx, &other_delimiter)
self.parse_matcher_subseq_upto(&mut name_idx, &other_delimiter)
}
_ => self.fatal("expected open delimiter")
}
Expand All @@ -2217,7 +2216,7 @@ impl<'a> Parser<'a> {
// Otherwise, `$( ( )` would be a valid Matcher, and `$( () )` would be
// invalid. It's similar to common::parse_seq.
pub fn parse_matcher_subseq_upto(&mut self,
name_idx: @Cell<uint>,
name_idx: &mut uint,
ket: &token::Token)
-> Vec<Matcher> {
let mut ret_val = Vec::new();
Expand All @@ -2234,27 +2233,27 @@ impl<'a> Parser<'a> {
return ret_val;
}

pub fn parse_matcher(&mut self, name_idx: @Cell<uint>) -> Matcher {
pub fn parse_matcher(&mut self, name_idx: &mut uint) -> Matcher {
let lo = self.span.lo;

let m = if self.token == token::DOLLAR {
self.bump();
if self.token == token::LPAREN {
let name_idx_lo = name_idx.get();
let name_idx_lo = *name_idx;
self.bump();
let ms = self.parse_matcher_subseq_upto(name_idx,
&token::RPAREN);
if ms.len() == 0u {
self.fatal("repetition body must be nonempty");
}
let (sep, zerok) = self.parse_sep_and_zerok();
MatchSeq(ms, sep, zerok, name_idx_lo, name_idx.get())
MatchSeq(ms, sep, zerok, name_idx_lo, *name_idx)
} else {
let bound_to = self.parse_ident();
self.expect(&token::COLON);
let nt_name = self.parse_ident();
let m = MatchNonterminal(bound_to, nt_name, name_idx.get());
name_idx.set(name_idx.get() + 1u);
let m = MatchNonterminal(bound_to, nt_name, *name_idx);
*name_idx += 1;
m
}
} else {
Expand Down