about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/middle/ty.rs2
-rw-r--r--src/librustc/middle/typeck/collect.rs22
-rw-r--r--src/librustc/middle/typeck/infer/unify.rs2
3 files changed, 24 insertions, 2 deletions
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 002e04ca475..26f4310bf1c 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -569,7 +569,7 @@ struct FnSig {
  * by the meta information because, in some cases, the
  * meta information is inferred. */
 #[deriving_eq]
-struct FnTyBase<M: cmp::Eq> {
+struct FnTyBase<M> {
     meta: M,        // Either FnMeta or FnVid
     sig: FnSig      // Types of arguments/return type
 }
diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs
index ce0c7a94c7c..8374a65f63c 100644
--- a/src/librustc/middle/typeck/collect.rs
+++ b/src/librustc/middle/typeck/collect.rs
@@ -598,6 +598,20 @@ fn convert_methods(ccx: @crate_ctxt,
     }
 }
 
+fn ensure_no_ty_param_bounds(ccx: @crate_ctxt,
+                             span: span,
+                             ty_params: &[ast::ty_param],
+                             thing: &static/str) {
+    for ty_params.each |ty_param| {
+        if ty_param.bounds.len() > 0 {
+            ccx.tcx.sess.span_err(
+                span,
+                fmt!("trait bounds are not allowed in %s definitions",
+                     thing));
+        }
+    }
+}
+
 fn convert(ccx: @crate_ctxt, it: @ast::item) {
     let tcx = ccx.tcx;
     let rp = tcx.region_paramd_items.find(it.id);
@@ -607,6 +621,7 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
       // These don't define types.
       ast::item_foreign_mod(_) | ast::item_mod(_) => {}
       ast::item_enum(ref enum_definition, ref ty_params) => {
+        ensure_no_ty_param_bounds(ccx, it.span, *ty_params, "enumeration");
         let tpt = ty_of_item(ccx, it);
         write_ty_to_tcx(tcx, it.id, tpt.ty);
         get_enum_variant_types(ccx,
@@ -644,6 +659,8 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
         let _ = convert_methods(ccx, provided_methods, rp, bounds);
       }
       ast::item_struct(struct_def, tps) => {
+        ensure_no_ty_param_bounds(ccx, it.span, tps, "structure");
+
         // Write the class type
         let tpt = ty_of_item(ccx, it);
         write_ty_to_tcx(tcx, it.id, tpt.ty);
@@ -651,6 +668,11 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
 
         convert_struct(ccx, rp, struct_def, tps, tpt, it.id);
       }
+      ast::item_ty(_, ref ty_params) => {
+        ensure_no_ty_param_bounds(ccx, it.span, *ty_params, "type");
+        let tpt = ty_of_item(ccx, it);
+        write_ty_to_tcx(tcx, it.id, tpt.ty);
+      }
       _ => {
         // This call populates the type cache with the converted type
         // of the item in passing. All we have to do here is to write
diff --git a/src/librustc/middle/typeck/infer/unify.rs b/src/librustc/middle/typeck/infer/unify.rs
index 6c831427b03..b2b1188388f 100644
--- a/src/librustc/middle/typeck/infer/unify.rs
+++ b/src/librustc/middle/typeck/infer/unify.rs
@@ -31,7 +31,7 @@ struct ValsAndBindings<V, T> {
     mut bindings: ~[(V, VarValue<V, T>)],
 }
 
-struct Node<V:Copy, T:Copy> {
+struct Node<V, T> {
     root: V,
     possible_types: T,
     rank: uint,