about summary refs log tree commit diff
path: root/src/rustc
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-06-25 13:29:41 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-06-25 13:29:41 -0700
commitda470ff5b8b970c90b4dce3885a2908d477c1021 (patch)
treef65aa2d105f18cdeb79321a37e47e26a5f592149 /src/rustc
parent44d0a061be0ec9cae51c61b7bb335e8c4b8c6cf5 (diff)
parentfad307d7b4aa5e7ff6cf30194b069062aaad1a89 (diff)
downloadrust-da470ff5b8b970c90b4dce3885a2908d477c1021.tar.gz
rust-da470ff5b8b970c90b4dce3885a2908d477c1021.zip
Merge
Diffstat (limited to 'src/rustc')
-rw-r--r--src/rustc/middle/block_use.rs2
-rw-r--r--src/rustc/middle/trans/base.rs1
-rw-r--r--src/rustc/middle/ty.rs10
-rw-r--r--src/rustc/middle/typeck.rs8
-rw-r--r--src/rustc/middle/typeck/astconv.rs6
-rw-r--r--src/rustc/middle/typeck/check.rs38
6 files changed, 34 insertions, 31 deletions
diff --git a/src/rustc/middle/block_use.rs b/src/rustc/middle/block_use.rs
index ea1cb3f235e..9fcc3d286fc 100644
--- a/src/rustc/middle/block_use.rs
+++ b/src/rustc/middle/block_use.rs
@@ -34,7 +34,7 @@ fn visit_expr(ex: @expr, cx: ctx, v: visit::vt<ctx>) {
             i += 1u;
         }
       }
-      expr_loop_body(body) {
+      expr_loop_body(body) | expr_do_body(body) {
         cx.allow_block = true;
         v.visit_expr(body, cx, v);
       }
diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs
index 13201d4e673..43eb9f8c58d 100644
--- a/src/rustc/middle/trans/base.rs
+++ b/src/rustc/middle/trans/base.rs
@@ -1752,7 +1752,6 @@ fn trans_assign_op(bcx: block, ex: @ast::expr, op: ast::binop,
             arg_exprs([src]), save_in(target));
 
         ret move_val(bcx, DROP_EXISTING, lhs_res.val,
-                     // FIXME (#2704): should kind be owned?
                      {bcx: bcx, val: target, kind: owned},
                      dty);
       }
diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs
index 1c0f5ed053c..c5aa42186bc 100644
--- a/src/rustc/middle/ty.rs
+++ b/src/rustc/middle/ty.rs
@@ -677,7 +677,7 @@ fn mk_nil_ptr(cx: ctxt) -> t {
     mk_ptr(cx, {ty: mk_nil(cx), mutbl: ast::m_imm})
 }
 
-fn mk_vec(cx: ctxt, tm: mt) -> t { mk_t(cx, ty_vec(tm)) }
+fn mk_vec(cx: ctxt, tm: mt) -> t { mk_evec(cx, tm, vstore_uniq) }
 
 fn mk_evec(cx: ctxt, tm: mt, t: vstore) -> t {
     mk_t(cx, ty_evec(tm, t))
@@ -1472,7 +1472,7 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
       ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) |
       ty_ptr(_) { kind_implicitly_sendable() | kind_const() }
       // Implicit copyability of strs is configurable
-      ty_str {
+      ty_str | ty_estr(vstore_uniq) {
         if cx.vecs_implicitly_copyable {
             kind_implicitly_sendable() | kind_const()
         } else { kind_sendable() | kind_const() }
@@ -1502,7 +1502,7 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
         remove_implicit(mutable_type_kind(cx, tm))
       }
       // Implicit copyability of vecs is configurable
-      ty_vec(tm) {
+      ty_vec(tm) | ty_evec(tm, vstore_uniq) {
           if cx.vecs_implicitly_copyable {
               mutable_type_kind(cx, tm)
           } else { remove_implicit(mutable_type_kind(cx, tm)) }
@@ -1520,9 +1520,6 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
             kind_implicitly_copyable()
         }
       }
-      ty_evec(tm, vstore_uniq) {
-        remove_implicit(mutable_type_kind(cx, tm))
-      }
       ty_evec(tm, vstore_fixed(_)) {
         mutable_type_kind(cx, tm)
       }
@@ -1530,7 +1527,6 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
       // All estrs are copyable; uniques and interiors are sendable.
       ty_estr(vstore_box) |
       ty_estr(vstore_slice(_)) { kind_implicitly_copyable() | kind_const() }
-      ty_estr(vstore_uniq) { kind_sendable() | kind_const() }
       ty_estr(vstore_fixed(_)) { kind_implicitly_sendable() | kind_const() }
 
       // Records lower to the lowest of their members.
diff --git a/src/rustc/middle/typeck.rs b/src/rustc/middle/typeck.rs
index 3c7bddc9022..ad1a613e739 100644
--- a/src/rustc/middle/typeck.rs
+++ b/src/rustc/middle/typeck.rs
@@ -218,7 +218,7 @@ fn require_same_types(
 
 fn arg_is_argv_ty(_tcx: ty::ctxt, a: ty::arg) -> bool {
     alt ty::get(a.ty).struct {
-      ty::ty_vec(mt) {
+      ty::ty_evec(mt, vstore_uniq) {
         if mt.mutbl != ast::m_imm { ret false; }
         alt ty::get(mt.ty).struct {
           ty::ty_str { ret true; }
@@ -271,12 +271,12 @@ fn check_main_fn_ty(ccx: @crate_ctxt,
     }
 }
 
-fn check_for_main_fn(ccx: @crate_ctxt, crate: @ast::crate) {
+fn check_for_main_fn(ccx: @crate_ctxt) {
     let tcx = ccx.tcx;
     if !tcx.sess.building_library {
         alt copy tcx.sess.main_fn {
           some((id, sp)) { check_main_fn_ty(ccx, id, sp); }
-          none { tcx.sess.span_err(crate.span, "main function not found"); }
+          none { tcx.sess.err("main function not found"); }
         }
     }
 }
@@ -289,7 +289,7 @@ fn check_crate(tcx: ty::ctxt, impl_map: resolve::impl_map,
                 tcx: tcx};
     collect::collect_item_types(ccx, crate);
     check::check_item_types(ccx, crate);
-    check_for_main_fn(ccx, crate);
+    check_for_main_fn(ccx);
     tcx.sess.abort_if_errors();
     (ccx.method_map, ccx.vtable_map)
 }
diff --git a/src/rustc/middle/typeck/astconv.rs b/src/rustc/middle/typeck/astconv.rs
index 476ef9d3ba5..c40b86d0530 100644
--- a/src/rustc/middle/typeck/astconv.rs
+++ b/src/rustc/middle/typeck/astconv.rs
@@ -170,6 +170,12 @@ fn ast_ty_to_ty<AC: ast_conv, RS: region_scope copy>(
             ret ty::mk_evec(tcx, mt, vst);
           }
 
+          // HACK: if we get a []/~, we assume that it was actually a
+          // [] that got written down, and we throw away the /~...
+          ty::ty_evec(mt, vstore_uniq) {
+            ret ty::mk_evec(tcx, mt, vst);
+          }
+
           ty::ty_str {
             ret ty::mk_estr(tcx, vst);
           }
diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs
index 86d105adb99..5ba7c88d3cd 100644
--- a/src/rustc/middle/typeck/check.rs
+++ b/src/rustc/middle/typeck/check.rs
@@ -381,7 +381,7 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) {
           // Check that there's at least one field
           let (fields,_) = split_class_items(members);
           if fields.len() < 1u {
-              ccx.tcx.sess.span_err(it.span, "A class must have at least one \
+              ccx.tcx.sess.span_err(it.span, "a class must have at least one \
                 field");
           }
           // Check that the class is instantiable
@@ -938,7 +938,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
                 // separate case below.
                 tcx.sess.span_bug(
                     expr.span,
-                    #fmt["Comparison operator in expr_binop: %s",
+                    #fmt["comparison operator in expr_binop: %s",
                          ast_util::binop_to_str(op)]);
               }
               _ { lhs_t }
@@ -1217,7 +1217,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
               result::ok(_) { /* fall through */ }
               result::err(_) {
                 tcx.sess.span_err(expr.span,
-                                  "ret; in function returning non-nil"); }
+                                  "`ret;` in function returning non-nil"); }
             }
           }
           some(e) { check_expr_with(fcx, e, ret_ty); }
@@ -1299,7 +1299,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
               result::ok(_) {}
               result::err(err) {
                 tcx.sess.span_fatal(
-                    expr.span, #fmt("a loop function's last argument \
+                    expr.span, #fmt("a `loop` function's last argument \
                                      should return `bool`, not `%s`",
                                     fcx.infcx.ty_to_str(fty.output)));
               }
@@ -1307,8 +1307,9 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
             (ty::mk_fn(tcx, {output: ty::mk_nil(tcx) with fty}), fty.proto)
           }
           _ {
-            tcx.sess.span_fatal(expr.span, "a loop function's last argument \
-                                            should be of function type");
+            tcx.sess.span_fatal(expr.span, "a `loop` function's last \
+                                            argument should be of function \
+                                            type");
           }
         };
         alt check b.node {
@@ -1334,7 +1335,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
             (ty::mk_fn(tcx, fty), fty.proto)
           }
           _ {
-            tcx.sess.span_fatal(expr.span, "a do function's last argument \
+            tcx.sess.span_fatal(expr.span, "a `do` function's last argument \
                                             should be of function type");
           }
         };
@@ -1547,8 +1548,9 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
               }
               none {
                 let t_err = fcx.infcx.resolve_type_vars_if_possible(expr_t);
-                let msg = #fmt["attempted access of field %s on type %s, but \
-                          no public field or method with that name was found",
+                let msg = #fmt["attempted access of field `%s` on type `%s`, \
+                                but no public field or method with that name \
+                                was found",
                                *field, fcx.infcx.ty_to_str(t_err)];
                 tcx.sess.span_err(expr.span, msg);
                 // NB: Adding a bogus type to allow typechecking to continue
@@ -1781,8 +1783,8 @@ fn check_instantiable(tcx: ty::ctxt,
     let rty = ty::node_id_to_type(tcx, item_id);
     if !ty::is_instantiable(tcx, rty) {
         tcx.sess.span_err(sp, #fmt["this type cannot be instantiated \
-                                    without an instance of itself. \
-                                    Consider using option<%s>.",
+                                    without an instance of itself; \
+                                    consider using `option<%s>`",
                                    ty_to_str(tcx, rty)]);
     }
 }
@@ -1821,7 +1823,7 @@ fn check_enum_variants(ccx: @crate_ctxt,
         }
         if vec::contains(disr_vals, disr_val) {
             ccx.tcx.sess.span_err(v.span,
-                                  "discriminator value already exists.");
+                                  "discriminator value already exists");
         }
         disr_vals += [disr_val];
         let ctor_ty = ty::node_id_to_type(ccx.tcx, v.node.id);
@@ -1848,7 +1850,7 @@ fn check_enum_variants(ccx: @crate_ctxt,
           _ { false }
         }
     }) {
-        ccx.tcx.sess.span_err(sp, "illegal recursive enum type. \
+        ccx.tcx.sess.span_err(sp, "illegal recursive enum type; \
                                    wrap the inner value in a box to \
                                    make it representable");
     }
@@ -2195,13 +2197,13 @@ fn check_bounds_are_used(ccx: @crate_ctxt,
     if !r_used {
         ccx.tcx.sess.span_err(
             span, "lifetime `self` unused inside \
-                   reference-parameterized type.");
+                   reference-parameterized type");
     }
 
     for tps_used.eachi { |i, b|
         if !b {
             ccx.tcx.sess.span_err(
-                span, #fmt["Type parameter %s is unused.", *tps[i].ident]);
+                span, #fmt["type parameter `%s` is unused", *tps[i].ident]);
         }
     }
 }
@@ -2268,13 +2270,13 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::native_item) {
     let i_n_tps = (*i_ty.bounds).len();
     if i_n_tps != n_tps {
         tcx.sess.span_err(it.span, #fmt("intrinsic has wrong number \
-                                         of type parameters. found %u, \
+                                         of type parameters: found %u, \
                                          expected %u", i_n_tps, n_tps));
     } else {
         require_same_types(
             tcx, none, it.span, i_ty.ty, fty,
-            {|| #fmt["intrinsic has wrong type. \
-                      expected %s",
+            {|| #fmt["intrinsic has wrong type: \
+                      expected `%s`",
                      ty_to_str(ccx.tcx, fty)]});
     }
 }