summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-12-17 06:26:40 -0800
committerbors <bors@rust-lang.org>2013-12-17 06:26:40 -0800
commit1a26bd166a3c029a17f4a5fdb6021d7de7c7eb48 (patch)
treebdf1bf1baa1da7987ec608901a62a847dd3cf71f /src/libsyntax
parentfb6ec38352b56250045f7450af4eb2af1a019dcd (diff)
parent4a1336401072bdbac9601c97e278795b1a4b9763 (diff)
downloadrust-1a26bd166a3c029a17f4a5fdb6021d7de7c7eb48.tar.gz
rust-1a26bd166a3c029a17f4a5fdb6021d7de7c7eb48.zip
auto merge of #11005 : sanxiyn/rust/mut, r=alexcrichton
There is no `~mut T` and `[mut T]` any more.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs6
-rw-r--r--src/libsyntax/ext/build.rs2
-rw-r--r--src/libsyntax/ext/format.rs2
-rw-r--r--src/libsyntax/fold.rs8
-rw-r--r--src/libsyntax/parse/parser.rs17
-rw-r--r--src/libsyntax/print/pprust.rs18
-rw-r--r--src/libsyntax/visit.rs10
7 files changed, 28 insertions, 35 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index e64e1615041..8e6e0625138 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -875,9 +875,9 @@ pub enum ty_ {
     ty_nil,
     ty_bot, /* bottom type */
     ty_box(mt),
-    ty_uniq(mt),
-    ty_vec(mt),
-    ty_fixed_length_vec(mt, @Expr),
+    ty_uniq(P<Ty>),
+    ty_vec(P<Ty>),
+    ty_fixed_length_vec(P<Ty>, @Expr),
     ty_ptr(mt),
     ty_rptr(Option<Lifetime>, mt),
     ty_closure(@TyClosure),
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 8a8de3906c4..930d25e7443 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -312,7 +312,7 @@ impl AstBuilder for @ExtCtxt {
                 ast::ty_rptr(lifetime, self.ty_mt(ty, mutbl)))
     }
     fn ty_uniq(&self, span: Span, ty: P<ast::Ty>) -> P<ast::Ty> {
-        self.ty(span, ast::ty_uniq(self.ty_mt(ty, ast::MutImmutable)))
+        self.ty(span, ast::ty_uniq(ty))
     }
     fn ty_box(&self, span: Span,
                  ty: P<ast::Ty>, mutbl: ast::Mutability) -> P<ast::Ty> {
diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs
index 9193a9cee17..98ebc24427d 100644
--- a/src/libsyntax/ext/format.rs
+++ b/src/libsyntax/ext/format.rs
@@ -593,7 +593,7 @@ impl Context {
                 ~[]
             ), None);
         let ty = ast::ty_fixed_length_vec(
-            self.ecx.ty_mt(piece_ty, ast::MutImmutable),
+            piece_ty,
             self.ecx.expr_uint(self.fmtsp, self.pieces.len())
         );
         let ty = self.ecx.ty(self.fmtsp, ty);
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index 3547fa8251b..a7faeee494e 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -241,8 +241,8 @@ pub trait ast_fold {
         let node = match t.node {
             ty_nil | ty_bot | ty_infer => t.node.clone(),
             ty_box(ref mt) => ty_box(fold_mt(mt, self)),
-            ty_uniq(ref mt) => ty_uniq(fold_mt(mt, self)),
-            ty_vec(ref mt) => ty_vec(fold_mt(mt, self)),
+            ty_uniq(ty) => ty_uniq(self.fold_ty(ty)),
+            ty_vec(ty) => ty_vec(self.fold_ty(ty)),
             ty_ptr(ref mt) => ty_ptr(fold_mt(mt, self)),
             ty_rptr(ref region, ref mt) => {
                 ty_rptr(fold_opt_lifetime(region, self), fold_mt(mt, self))
@@ -272,8 +272,8 @@ pub trait ast_fold {
                         fold_opt_bounds(bounds, self),
                         self.new_id(id))
             }
-            ty_fixed_length_vec(ref mt, e) => {
-                ty_fixed_length_vec(fold_mt(mt, self), self.fold_expr(e))
+            ty_fixed_length_vec(ty, e) => {
+                ty_fixed_length_vec(self.fold_ty(ty), self.fold_expr(e))
             }
             ty_typeof(expr) => ty_typeof(self.fold_expr(expr)),
         };
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 33e3bae99a7..9ab6cc96d33 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1213,11 +1213,11 @@ impl Parser {
         } else if *self.token == token::AT {
             // MANAGED POINTER
             self.bump();
-            self.parse_box_or_uniq_pointee(ManagedSigil, ty_box)
+            self.parse_box_or_uniq_pointee(ManagedSigil)
         } else if *self.token == token::TILDE {
             // OWNED POINTER
             self.bump();
-            self.parse_box_or_uniq_pointee(OwnedSigil, ty_uniq)
+            self.parse_box_or_uniq_pointee(OwnedSigil)
         } else if *self.token == token::BINOP(token::STAR) {
             // STAR POINTER (bare pointer?)
             self.bump();
@@ -1225,13 +1225,13 @@ impl Parser {
         } else if *self.token == token::LBRACKET {
             // VECTOR
             self.expect(&token::LBRACKET);
-            let mt = mt { ty: self.parse_ty(false), mutbl: MutImmutable };
+            let t = self.parse_ty(false);
 
             // Parse the `, ..e` in `[ int, ..e ]`
             // where `e` is a const expression
             let t = match self.maybe_parse_fixed_vstore() {
-                None => ty_vec(mt),
-                Some(suffix) => ty_fixed_length_vec(mt, suffix)
+                None => ty_vec(t),
+                Some(suffix) => ty_fixed_length_vec(t, suffix)
             };
             self.expect(&token::RBRACKET);
             t
@@ -1284,8 +1284,7 @@ impl Parser {
 
     // parse the type following a @ or a ~
     pub fn parse_box_or_uniq_pointee(&self,
-                                     sigil: ast::Sigil,
-                                     ctor: |v: mt| -> ty_)
+                                     sigil: ast::Sigil)
                                      -> ty_ {
         // ~'foo fn() or ~fn() are parsed directly as obsolete fn types:
         match *self.token {
@@ -1309,9 +1308,9 @@ impl Parser {
         // rather than boxed ptrs.  But the special casing of str/vec is not
         // reflected in the AST type.
         if sigil == OwnedSigil {
-            ctor(mt { ty: self.parse_ty(false), mutbl: MutImmutable })
+            ty_uniq(self.parse_ty(false))
         } else {
-            ctor(self.parse_mt())
+            ty_box(self.parse_mt())
         }
     }
 
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 568501a73bb..7cea2ed3f9c 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -401,14 +401,10 @@ pub fn print_type(s: @ps, ty: &ast::Ty) {
       ast::ty_nil => word(s.s, "()"),
       ast::ty_bot => word(s.s, "!"),
       ast::ty_box(ref mt) => { word(s.s, "@"); print_mt(s, mt); }
-      ast::ty_uniq(ref mt) => { word(s.s, "~"); print_mt(s, mt); }
-      ast::ty_vec(ref mt) => {
+      ast::ty_uniq(ty) => { word(s.s, "~"); print_type(s, ty); }
+      ast::ty_vec(ty) => {
         word(s.s, "[");
-        match mt.mutbl {
-          ast::MutMutable => word_space(s, "mut"),
-          ast::MutImmutable => ()
-        }
-        print_type(s, mt.ty);
+        print_type(s, ty);
         word(s.s, "]");
       }
       ast::ty_ptr(ref mt) => { word(s.s, "*"); print_mt(s, mt); }
@@ -444,13 +440,9 @@ pub fn print_type(s: @ps, ty: &ast::Ty) {
                       Some(&generics), None);
       }
       ast::ty_path(ref path, ref bounds, _) => print_bounded_path(s, path, bounds),
-      ast::ty_fixed_length_vec(ref mt, v) => {
+      ast::ty_fixed_length_vec(ty, v) => {
         word(s.s, "[");
-        match mt.mutbl {
-            ast::MutMutable => word_space(s, "mut"),
-            ast::MutImmutable => ()
-        }
-        print_type(s, mt.ty);
+        print_type(s, ty);
         word(s.s, ", ..");
         print_expr(s, v);
         word(s.s, "]");
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 5e5c12391d6..8cc6fc4990f 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -302,8 +302,10 @@ pub fn skip_ty<E, V:Visitor<E>>(_: &mut V, _: &Ty, _: E) {
 
 pub fn walk_ty<E:Clone, V:Visitor<E>>(visitor: &mut V, typ: &Ty, env: E) {
     match typ.node {
-        ty_box(ref mutable_type) | ty_uniq(ref mutable_type) |
-        ty_vec(ref mutable_type) | ty_ptr(ref mutable_type) => {
+        ty_uniq(ty) | ty_vec(ty) => {
+            visitor.visit_ty(ty, env)
+        }
+        ty_box(ref mutable_type) | ty_ptr(ref mutable_type) => {
             visitor.visit_ty(mutable_type.ty, env)
         }
         ty_rptr(ref lifetime, ref mutable_type) => {
@@ -344,8 +346,8 @@ pub fn walk_ty<E:Clone, V:Visitor<E>>(visitor: &mut V, typ: &Ty, env: E) {
                 walk_ty_param_bounds(visitor, bounds, env.clone())
             }
         }
-        ty_fixed_length_vec(ref mutable_type, expression) => {
-            visitor.visit_ty(mutable_type.ty, env.clone());
+        ty_fixed_length_vec(ty, expression) => {
+            visitor.visit_ty(ty, env.clone());
             visitor.visit_expr(expression, env)
         }
         ty_typeof(expression) => {