about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGeorg Semmler <georg_semmler_05@web.de>2019-09-18 22:14:33 +0200
committerGeorg Semmler <georg_semmler_05@web.de>2019-09-18 22:14:33 +0200
commita9c38d9d01bd50b5a264cd62fd32cec37f006ab9 (patch)
tree97199225dd4af826491475fb0e057661c4a5a97e /src
parent3f004a1bc44859857f05a9f692a578124b3f3e01 (diff)
Add more tests
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/coherence/impl-foreign[foreign]-for-foreign.rs16
-rw-r--r--src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr12
-rw-r--r--src/test/ui/coherence/impl-foreign[foreign]-for-local.rs16
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs20
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr19
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.rs16
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr11
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[fundamental[t],local]-for-foreign.rs20
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[fundamental[t],local]-for-foreign.stderr19
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.rs20
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr19
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs19
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr19
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-local.rs17
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.rs19
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr19
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[local, fundamental[t]]-for-foreign.rs19
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[local]-for-foreign.rs16
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[local]-for-local.rs15
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.rs16
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr11
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs20
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr19
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[t]-for-local.rs15
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[t]-for-t.rs16
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr11
26 files changed, 439 insertions, 0 deletions
diff --git a/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.rs b/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.rs
new file mode 100644
index 00000000000..57738c64e37
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.rs
@@ -0,0 +1,16 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl Remote1<u32> for f64 {
+    //~^ ERROR only traits defined in the current crate can be implemented for arbitrary types [E0117]
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr b/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr
new file mode 100644
index 00000000000..04e96f29230
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr
@@ -0,0 +1,12 @@
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+  --> $DIR/impl-foreign[foreign]-for-foreign.rs:12:1
+   |
+LL | impl Remote1<u32> for f64 {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   |
+   = note: the impl does not reference only types defined in this crate
+   = note: define and implement a trait or new type instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0117`.
diff --git a/src/test/ui/coherence/impl-foreign[foreign]-for-local.rs b/src/test/ui/coherence/impl-foreign[foreign]-for-local.rs
new file mode 100644
index 00000000000..33e85c16476
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign[foreign]-for-local.rs
@@ -0,0 +1,16 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+// check-pass
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl Remote1<u32> for Local {
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs
new file mode 100644
index 00000000000..66a4d9d2734
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs
@@ -0,0 +1,20 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl<T> Remote1<u32> for Box<T> {
+    //~^ ERROR type parameter `T` must be used as the type parameter for some local type
+}
+
+impl<'a, T> Remote1<u32> for &'a T {
+    //~^ ERROR type parameter `T` must be used as the type parameter for some local type
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr
new file mode 100644
index 00000000000..2467097b1a8
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr
@@ -0,0 +1,19 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
+  --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:12:1
+   |
+LL | impl<T> Remote1<u32> for Box<T> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
+  --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:16:1
+   |
+LL | impl<'a, T> Remote1<u32> for &'a T {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.rs b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.rs
new file mode 100644
index 00000000000..0a67ebcbba4
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.rs
@@ -0,0 +1,16 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl<T> Remote1<u32> for T {
+    //~^ ERROR type parameter `T` must be used as the type parameter for some local type
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr
new file mode 100644
index 00000000000..5c28406f113
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
+  --> $DIR/impl[t]-foreign[foreign]-for-t.rs:12:1
+   |
+LL | impl<T> Remote1<u32> for T {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t],local]-for-foreign.rs b/src/test/ui/coherence/impl[t]-foreign[fundamental[t],local]-for-foreign.rs
new file mode 100644
index 00000000000..24e0f309c45
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t],local]-for-foreign.rs
@@ -0,0 +1,20 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl<T> Remote2<Box<T>, Local> for u32 {
+    //~^ ERROR type parameter `T` must be used as the type parameter for some local type
+}
+
+impl<'a, T> Remote2<&'a T, Local> for u32 {
+    //~^ ERROR type parameter `T` must be used as the type parameter for some local type
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t],local]-for-foreign.stderr b/src/test/ui/coherence/impl[t]-foreign[fundamental[t],local]-for-foreign.stderr
new file mode 100644
index 00000000000..da670bcfc3f
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t],local]-for-foreign.stderr
@@ -0,0 +1,19 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
+  --> $DIR/impl[t]-foreign[fundamental[t],local]-for-foreign.rs:12:1
+   |
+LL | impl<T> Remote2<Box<T>, Local> for u32 {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
+  --> $DIR/impl[t]-foreign[fundamental[t],local]-for-foreign.rs:16:1
+   |
+LL | impl<'a, T> Remote2<&'a T, Local> for u32 {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.rs b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.rs
new file mode 100644
index 00000000000..71598dae96a
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.rs
@@ -0,0 +1,20 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl<T> Remote1<Box<T>> for u32 {
+    //~^ ERROR type parameter `T` must be used as the type parameter for some local type
+}
+
+impl<'a, T> Remote1<&'a T> for u32 {
+    //~^ ERROR type parameter `T` must be used as the type parameter for some local type
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr
new file mode 100644
index 00000000000..dd970265079
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr
@@ -0,0 +1,19 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
+  --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:12:1
+   |
+LL | impl<T> Remote1<Box<T>> for u32 {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
+  --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:16:1
+   |
+LL | impl<'a, T> Remote1<&'a T> for u32 {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs
new file mode 100644
index 00000000000..7bf0306f29b
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs
@@ -0,0 +1,19 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl<'a, T> Remote1<Box<T>> for &'a T {
+    //~^ ERROR type parameter `T` must be used as the type parameter for some local type
+}
+impl<'a, T> Remote1<&'a T> for Box<T> {
+    //~^ ERROR type parameter `T` must be used as the type parameter for some local type
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr
new file mode 100644
index 00000000000..eec57fccea7
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr
@@ -0,0 +1,19 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
+  --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:12:1
+   |
+LL | impl<'a, T> Remote1<Box<T>> for &'a T {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
+  --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:15:1
+   |
+LL | impl<'a, T> Remote1<&'a T> for Box<T> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-local.rs b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-local.rs
new file mode 100644
index 00000000000..54d577c7492
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-local.rs
@@ -0,0 +1,17 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+// check-pass
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl<T> Remote1<Box<T>> for Local {}
+
+impl<'a, T> Remote1<&'a T> for Local {}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.rs b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.rs
new file mode 100644
index 00000000000..7af929006ef
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.rs
@@ -0,0 +1,19 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl<T> Remote1<Box<T>> for T {
+    //~^ ERROR type parameter `T` must be used as the type parameter for some local type
+}
+impl<'a, T> Remote1<&'a T> for T {
+    //~^ ERROR type parameter `T` must be used as the type parameter for some local type
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr
new file mode 100644
index 00000000000..e017c3ffe6c
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr
@@ -0,0 +1,19 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
+  --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:12:1
+   |
+LL | impl<T> Remote1<Box<T>> for T {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
+  --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:15:1
+   |
+LL | impl<'a, T> Remote1<&'a T> for T {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/ui/coherence/impl[t]-foreign[local, fundamental[t]]-for-foreign.rs b/src/test/ui/coherence/impl[t]-foreign[local, fundamental[t]]-for-foreign.rs
new file mode 100644
index 00000000000..be0875d0110
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[local, fundamental[t]]-for-foreign.rs
@@ -0,0 +1,19 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+// check-pass
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+struct Local2<T>(Rc<T>);
+
+impl<T> Remote2<Local, Box<T>> for u32 {}
+impl<'a, T> Remote2<Local, &'a T> for u32 {}
+impl<T> Remote2<Local2<T>, Box<T>> for u32 {}
+impl<'a, T> Remote2<Local2<T>, &'a T> for u32 {}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[local]-for-foreign.rs b/src/test/ui/coherence/impl[t]-foreign[local]-for-foreign.rs
new file mode 100644
index 00000000000..81cf3c3f6ec
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[local]-for-foreign.rs
@@ -0,0 +1,16 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+// check-pass
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl<T> Remote1<Local> for Rc<T> {}
+impl<T> Remote1<Local> for Vec<Box<T>> {}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[local]-for-local.rs b/src/test/ui/coherence/impl[t]-foreign[local]-for-local.rs
new file mode 100644
index 00000000000..6b1d93cd944
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[local]-for-local.rs
@@ -0,0 +1,15 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+// check-pass
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl Remote1<Local> for Local {}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.rs b/src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.rs
new file mode 100644
index 00000000000..5e89c207733
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.rs
@@ -0,0 +1,16 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl<T> Remote1<T> for u32 {
+    //~^ ERROR type parameter `T` must be used as the type parameter for some local type
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr b/src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr
new file mode 100644
index 00000000000..5544729b5d6
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
+  --> $DIR/impl[t]-foreign[t]-for-foreign.rs:12:1
+   |
+LL | impl<T> Remote1<T> for u32 {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs b/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs
new file mode 100644
index 00000000000..300a2c4d48a
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs
@@ -0,0 +1,20 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl<T> Remote1<T> for Box<T> {
+    //~^ ERROR type parameter `T` must be used as the type parameter for some local type
+}
+
+impl<'a, A, B> Remote1<A> for &'a B {
+    //~^ ERROR type parameter `B` must be used as the type parameter for some local type
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr b/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr
new file mode 100644
index 00000000000..be8cc29a6e5
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr
@@ -0,0 +1,19 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
+  --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:12:1
+   |
+LL | impl<T> Remote1<T> for Box<T> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error[E0210]: type parameter `B` must be used as the type parameter for some local type (e.g., `MyStruct<B>`)
+  --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:16:1
+   |
+LL | impl<'a, A, B> Remote1<A> for &'a B {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `B` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/ui/coherence/impl[t]-foreign[t]-for-local.rs b/src/test/ui/coherence/impl[t]-foreign[t]-for-local.rs
new file mode 100644
index 00000000000..769147ea7ea
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[t]-for-local.rs
@@ -0,0 +1,15 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+// check-pass
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl<T> Remote1<T> for Local {}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[t]-for-t.rs b/src/test/ui/coherence/impl[t]-foreign[t]-for-t.rs
new file mode 100644
index 00000000000..c8513380ff7
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[t]-for-t.rs
@@ -0,0 +1,16 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl<T> Remote1<T> for T {
+    //~^ ERROR type parameter `T` must be used as the type parameter for some local type
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr b/src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr
new file mode 100644
index 00000000000..de857afd20b
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
+  --> $DIR/impl[t]-foreign[t]-for-t.rs:12:1
+   |
+LL | impl<T> Remote1<T> for T {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |
+   = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.