about summary refs log tree commit diff
path: root/src/libregex_macros
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-06-11 19:33:52 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-06-14 10:45:37 -0700
commitade807c6dcf6dc4454732c5e914ca06ebb429773 (patch)
tree64606dac9c81ec4567e19f503d4d82e249dbf40a /src/libregex_macros
parentf20b1293fcce4e120bd4a57226e0817271cd672c (diff)
downloadrust-ade807c6dcf6dc4454732c5e914ca06ebb429773.tar.gz
rust-ade807c6dcf6dc4454732c5e914ca06ebb429773.zip
rustc: Obsolete the `@` syntax entirely
This removes all remnants of `@` pointers from rustc. Additionally, this removes
the `GC` structure from the prelude as it seems odd exporting an experimental
type in the prelude by default.

Closes #14193
[breaking-change]
Diffstat (limited to 'src/libregex_macros')
-rw-r--r--src/libregex_macros/lib.rs26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/libregex_macros/lib.rs b/src/libregex_macros/lib.rs
index bbee09d0f38..8641936cc34 100644
--- a/src/libregex_macros/lib.rs
+++ b/src/libregex_macros/lib.rs
@@ -26,6 +26,7 @@ extern crate syntax;
 extern crate rustc;
 
 use std::rc::Rc;
+use std::gc::{Gc, GC};
 
 use syntax::ast;
 use syntax::codemap;
@@ -110,7 +111,7 @@ struct NfaGen<'a> {
 }
 
 impl<'a> NfaGen<'a> {
-    fn code(&mut self) -> @ast::Expr {
+    fn code(&mut self) -> Gc<ast::Expr> {
         // Most or all of the following things are used in the quasiquoted
         // expression returned.
         let num_cap_locs = 2 * self.prog.num_captures();
@@ -331,7 +332,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
 
     // Generates code for the `add` method, which is responsible for adding
     // zero-width states to the next queue of states to visit.
-    fn add_insts(&self) -> @ast::Expr {
+    fn add_insts(&self) -> Gc<ast::Expr> {
         let arms = self.prog.insts.iter().enumerate().map(|(pc, inst)| {
             let nextpc = pc + 1;
             let body = match *inst {
@@ -432,7 +433,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
 
     // Generates the code for the `step` method, which processes all states
     // in the current queue that consume a single character.
-    fn step_insts(&self) -> @ast::Expr {
+    fn step_insts(&self) -> Gc<ast::Expr> {
         let arms = self.prog.insts.iter().enumerate().map(|(pc, inst)| {
             let nextpc = pc + 1;
             let body = match *inst {
@@ -523,7 +524,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
     // Translates a character class into a match expression.
     // This avoids a binary search (and is hopefully replaced by a jump
     // table).
-    fn match_class(&self, casei: bool, ranges: &[(char, char)]) -> @ast::Expr {
+    fn match_class(&self, casei: bool, ranges: &[(char, char)]) -> Gc<ast::Expr> {
         let expr_true = quote_expr!(self.cx, true);
 
         let mut arms = ranges.iter().map(|&(mut start, mut end)| {
@@ -545,7 +546,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
     // Generates code for checking a literal prefix of the search string.
     // The code is only generated if the regex *has* a literal prefix.
     // Otherwise, a no-op is returned.
-    fn check_prefix(&self) -> @ast::Expr {
+    fn check_prefix(&self) -> Gc<ast::Expr> {
         if self.prog.prefix.len() == 0 {
             self.empty_block()
         } else {
@@ -569,28 +570,28 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
     // A wild-card arm is automatically added that executes a no-op. It will
     // never be used, but is added to satisfy the compiler complaining about
     // non-exhaustive patterns.
-    fn match_insts(&self, mut arms: Vec<ast::Arm>) -> @ast::Expr {
+    fn match_insts(&self, mut arms: Vec<ast::Arm>) -> Gc<ast::Expr> {
         arms.push(self.wild_arm_expr(self.empty_block()));
         self.cx.expr_match(self.sp, quote_expr!(self.cx, pc), arms)
     }
 
-    fn empty_block(&self) -> @ast::Expr {
+    fn empty_block(&self) -> Gc<ast::Expr> {
         quote_expr!(self.cx, {})
     }
 
     // Creates a match arm for the instruction at `pc` with the expression
     // `body`.
-    fn arm_inst(&self, pc: uint, body: @ast::Expr) -> ast::Arm {
+    fn arm_inst(&self, pc: uint, body: Gc<ast::Expr>) -> ast::Arm {
         let pc_pat = self.cx.pat_lit(self.sp, quote_expr!(self.cx, $pc));
 
         self.cx.arm(self.sp, vec!(pc_pat), body)
     }
 
     // Creates a wild-card match arm with the expression `body`.
-    fn wild_arm_expr(&self, body: @ast::Expr) -> ast::Arm {
+    fn wild_arm_expr(&self, body: Gc<ast::Expr>) -> ast::Arm {
         ast::Arm {
             attrs: vec!(),
-            pats: vec!(@ast::Pat{
+            pats: vec!(box(GC) ast::Pat{
                 id: ast::DUMMY_NODE_ID,
                 span: self.sp,
                 node: ast::PatWild,
@@ -603,8 +604,9 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
 
     // Converts `xs` to a `[x1, x2, .., xN]` expression by calling `to_expr`
     // on each element in `xs`.
-    fn vec_expr<T, It: Iterator<T>>(&self, xs: It, to_expr: |&ExtCtxt, T| -> @ast::Expr)
-                  -> @ast::Expr {
+    fn vec_expr<T, It: Iterator<T>>(&self, xs: It,
+                                    to_expr: |&ExtCtxt, T| -> Gc<ast::Expr>)
+                  -> Gc<ast::Expr> {
         let exprs = xs.map(|x| to_expr(self.cx, x)).collect();
         self.cx.expr_vec(self.sp, exprs)
     }