Skip to content

Commit adedf13

Browse files
committed
---
yaml --- r: 91083 b: refs/heads/master c: f4118d5 h: refs/heads/master i: 91081: cb0b365 91079: 4cf8eff v: v3
1 parent f98a2f2 commit adedf13

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: a2f4877862b35b2dc4b089339b8147d255a8b516
2+
refs/heads/master: f4118d5a4c4962dd174d6af3f1bbcf688c3ed730
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8

trunk/src/libsyntax/parse/parser.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ pub fn Parser(sess: @mut ParseSess, cfg: ast::CrateConfig, rdr: @mut reader)
318318
quote_depth: 0,
319319
obsolete_set: HashSet::new(),
320320
mod_path_stack: ~[],
321-
open_braces: @mut ~[],
321+
open_braces: ~[],
322322
non_copyable: util::NonCopyable
323323
}
324324
}
@@ -349,7 +349,7 @@ pub struct Parser {
349349
/// Used to determine the path to externally loaded source files
350350
mod_path_stack: ~[@str],
351351
/// Stack of spans of open delimiters. Used for error message.
352-
open_braces: @mut ~[Span],
352+
open_braces: ~[Span],
353353
/* do not copy the parser; its state is tied to outside state */
354354
priv non_copyable: util::NonCopyable
355355
}
@@ -2093,7 +2093,10 @@ impl Parser {
20932093
// This is a conservative error: only report the last unclosed delimiter. The
20942094
// previous unclosed delimiters could actually be closed! The parser just hasn't
20952095
// gotten to them yet.
2096-
p.open_braces.last_opt().map(|sp| p.span_note(*sp, "unclosed delimiter"));
2096+
match p.open_braces.last_opt() {
2097+
None => {}
2098+
Some(&sp) => p.span_note(sp, "unclosed delimiter"),
2099+
};
20972100
let token_str = p.this_token_to_str();
20982101
p.fatal(format!("incorrect close delimiter: `{}`",
20992102
token_str))
@@ -2137,7 +2140,8 @@ impl Parser {
21372140

21382141
match self.token {
21392142
token::EOF => {
2140-
for sp in self.open_braces.iter() {
2143+
let open_braces = self.open_braces.clone();
2144+
for sp in open_braces.iter() {
21412145
self.span_note(*sp, "Did you mean to close this delimiter?");
21422146
}
21432147
// There shouldn't really be a span, but it's easier for the test runner
@@ -2148,7 +2152,7 @@ impl Parser {
21482152
let close_delim = token::flip_delimiter(&self.token);
21492153

21502154
// Parse the open delimiter.
2151-
(*self.open_braces).push(self.span);
2155+
self.open_braces.push(self.span);
21522156
let mut result = ~[parse_any_tt_tok(self)];
21532157

21542158
let trees =

0 commit comments

Comments
 (0)