diff options
| author | bors <bors@rust-lang.org> | 2014-03-22 09:51:49 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-03-22 09:51:49 -0700 |
| commit | 403e8695712cd9779b9cc91c61e780d3bfb8212a (patch) | |
| tree | 9be221d4577fa3a4960e8c653c0a4612ee298f72 /src/libsyntax/parse/parser.rs | |
| parent | 5e8e1b515a9ef1cd38ee0c71f032415906a7f42d (diff) | |
| parent | 9dc357b8ed0ebc0755f7247deb8314c74e1acf80 (diff) | |
| download | rust-403e8695712cd9779b9cc91c61e780d3bfb8212a.tar.gz rust-403e8695712cd9779b9cc91c61e780d3bfb8212a.zip | |
auto merge of #13053 : alexcrichton/rust/removing-ref-cell-get, r=huonw
This commit removes the `get()` method from `Ref` and `RefMut` in favor of the `*` operator, and removes all usage of the `deref()` function manually from rustc, favoring using `*` instead. Some of the code is a little wacky, but that's due to either #13044 or #13042
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c8492cc4113..1313225e22b 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4203,28 +4203,22 @@ impl<'a> Parser<'a> { path: Path, outer_attrs: Vec<ast::Attribute> , id_sp: Span) -> (ast::Item_, Vec<ast::Attribute> ) { - { - let mut included_mod_stack = self.sess - .included_mod_stack - .borrow_mut(); - let maybe_i = included_mod_stack.get() - .iter() - .position(|p| *p == path); - match maybe_i { - Some(i) => { - let mut err = ~"circular modules: "; - let len = included_mod_stack.get().len(); - for p in included_mod_stack.get().slice(i, len).iter() { - err.push_str(p.display().as_maybe_owned().as_slice()); - err.push_str(" -> "); - } - err.push_str(path.display().as_maybe_owned().as_slice()); - self.span_fatal(id_sp, err); + let mut included_mod_stack = self.sess.included_mod_stack.borrow_mut(); + match included_mod_stack.iter().position(|p| *p == path) { + Some(i) => { + let mut err = ~"circular modules: "; + let len = included_mod_stack.len(); + for p in included_mod_stack.slice(i, len).iter() { + err.push_str(p.display().as_maybe_owned().as_slice()); + err.push_str(" -> "); } - None => () + err.push_str(path.display().as_maybe_owned().as_slice()); + self.span_fatal(id_sp, err); } - included_mod_stack.get().push(path.clone()); + None => () } + included_mod_stack.push(path.clone()); + drop(included_mod_stack); let mut p0 = new_sub_parser_from_file(self.sess, @@ -4235,12 +4229,7 @@ impl<'a> Parser<'a> { let mod_attrs = vec::append(outer_attrs, inner.as_slice()); let first_item_outer_attrs = next; let m0 = p0.parse_mod_items(token::EOF, first_item_outer_attrs); - { - let mut included_mod_stack = self.sess - .included_mod_stack - .borrow_mut(); - included_mod_stack.get().pop(); - } + self.sess.included_mod_stack.borrow_mut().pop(); return (ast::ItemMod(m0), mod_attrs); } |
