about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonathan S <gereeter+code@gmail.com>2016-01-17 11:26:11 -0600
committerJonathan S <gereeter+code@gmail.com>2016-01-17 11:26:11 -0600
commit7a9c4a4941932b003590c6416619bbf5556c366a (patch)
treedb2be52b21eb6dd69f76b89fbba02689c69f85b6
parentfae75c93b3df9c99f10aee03acf5e5570d6fc3af (diff)
downloadrust-7a9c4a4941932b003590c6416619bbf5556c366a.tar.gz
rust-7a9c4a4941932b003590c6416619bbf5556c366a.zip
Expand the macro in variance-btree-invariant-types.rs to make compiletest recognize that it should error
-rw-r--r--src/test/compile-fail/variance-btree-invariant-types.rs79
1 files changed, 43 insertions, 36 deletions
diff --git a/src/test/compile-fail/variance-btree-invariant-types.rs b/src/test/compile-fail/variance-btree-invariant-types.rs
index ad94a3865ac..e9607de00a3 100644
--- a/src/test/compile-fail/variance-btree-invariant-types.rs
+++ b/src/test/compile-fail/variance-btree-invariant-types.rs
@@ -12,45 +12,52 @@
 
 use std::collections::btree_map::{IterMut, OccupiedEntry, VacantEntry};
 
-macro_rules! test_invariant {
-    { $m:ident $t:ident } => {
-        mod $m {
-            use std::collections::btree_map::{IterMut, OccupiedEntry, VacantEntry};
-
-            fn not_covariant_key<'a, 'min,'max>(v: $t<'a, &'max (), ()>)
-                                                -> $t<'a, &'min (), ()>
-                where 'max : 'min
-            {
-                v //~ ERROR mismatched types
-            }
-
-            fn not_contravariant_key<'a, 'min,'max>(v: $t<'a, &'min (), ()>)
-                                                    -> $t<'a, &'max (), ()>
-                where 'max : 'min
-            {
-                v //~ ERROR mismatched types
-            }
-
-            fn not_covariant_val<'a, 'min,'max>(v: $t<'a, (), &'max ()>)
-                                                -> $t<'a, (), &'min ()>
-                where 'max : 'min
-            {
-                v //~ ERROR mismatched types
-            }
+fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> {
+    v //~ ERROR mismatched types
+}
+fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> {
+    v //~ ERROR mismatched types
+}
+fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> {
+    v //~ ERROR mismatched types
+}
+fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> {
+    v //~ ERROR mismatched types
+}
 
-            fn not_contravariant_val<'a, 'min,'max>(v: $t<'a, (), &'min ()>)
-                                                    -> $t<'a, (), &'max ()>
-                where 'max : 'min
-            {
-                v //~ ERROR mismatched types
-            }
-        }
-    }
+fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>)
+                         -> OccupiedEntry<'a, &'new (), ()> {
+    v //~ ERROR mismatched types
+}
+fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>)
+                         -> OccupiedEntry<'a, (), &'new ()> {
+    v //~ ERROR mismatched types
+}
+fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>)
+                            -> OccupiedEntry<'a, &'static (), ()> {
+    v //~ ERROR mismatched types
+}
+fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>)
+                            -> OccupiedEntry<'a, (), &'static ()> {
+    v //~ ERROR mismatched types
 }
 
-test_invariant! { foo IterMut }
-test_invariant! { bar OccupiedEntry }
-test_invariant! { baz VacantEntry }
+fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>)
+                         -> VacantEntry<'a, &'new (), ()> {
+    v //~ ERROR mismatched types
+}
+fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>)
+                         -> VacantEntry<'a, (), &'new ()> {
+    v //~ ERROR mismatched types
+}
+fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>)
+                            -> VacantEntry<'a, &'static (), ()> {
+    v //~ ERROR mismatched types
+}
+fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>)
+                            -> VacantEntry<'a, (), &'static ()> {
+    v //~ ERROR mismatched types
+}
 
 #[rustc_error]
 fn main() { }