about summary refs log tree commit diff
path: root/src/test/ui/error-codes
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-05-24 22:07:35 +0100
committervarkor <github@varkor.com>2019-05-24 22:07:35 +0100
commitaea04009e47195caaf13701fbb042f9e7c6828bd (patch)
tree87aa4d25813420bde744d0ab0e0f2b57cecac89a /src/test/ui/error-codes
parentcb7e0d0dd3d3af62f76190d3f5f03332bb191023 (diff)
downloadrust-aea04009e47195caaf13701fbb042f9e7c6828bd.tar.gz
rust-aea04009e47195caaf13701fbb042f9e7c6828bd.zip
Move error code tests to error code folder
Diffstat (limited to 'src/test/ui/error-codes')
-rw-r--r--src/test/ui/error-codes/E0501.rs24
-rw-r--r--src/test/ui/error-codes/E0501.stderr31
-rw-r--r--src/test/ui/error-codes/E0506.rs11
-rw-r--r--src/test/ui/error-codes/E0506.stderr14
-rw-r--r--src/test/ui/error-codes/E0508-fail.rs6
-rw-r--r--src/test/ui/error-codes/E0508-fail.stderr12
-rw-r--r--src/test/ui/error-codes/E0508.rs6
-rw-r--r--src/test/ui/error-codes/E0508.stderr12
-rw-r--r--src/test/ui/error-codes/E0583.rs4
-rw-r--r--src/test/ui/error-codes/E0583.stderr11
-rw-r--r--src/test/ui/error-codes/E0594.rs5
-rw-r--r--src/test/ui/error-codes/E0594.stderr8
-rw-r--r--src/test/ui/error-codes/E0596.rs4
-rw-r--r--src/test/ui/error-codes/E0596.stderr11
-rw-r--r--src/test/ui/error-codes/E0642.rs16
-rw-r--r--src/test/ui/error-codes/E0642.stderr33
-rw-r--r--src/test/ui/error-codes/E0660.rs9
-rw-r--r--src/test/ui/error-codes/E0660.stderr14
-rw-r--r--src/test/ui/error-codes/E0661.rs7
-rw-r--r--src/test/ui/error-codes/E0661.stderr8
-rw-r--r--src/test/ui/error-codes/E0662.rs8
-rw-r--r--src/test/ui/error-codes/E0662.stderr8
-rw-r--r--src/test/ui/error-codes/E0663.rs8
-rw-r--r--src/test/ui/error-codes/E0663.stderr8
-rw-r--r--src/test/ui/error-codes/E0664.rs9
-rw-r--r--src/test/ui/error-codes/E0664.stderr8
-rw-r--r--src/test/ui/error-codes/E0665.rs8
-rw-r--r--src/test/ui/error-codes/E0665.stderr8
-rw-r--r--src/test/ui/error-codes/E0705.rs10
-rw-r--r--src/test/ui/error-codes/E0705.stderr6
-rw-r--r--src/test/ui/error-codes/e0119/auxiliary/complex_impl_support.rs22
-rw-r--r--src/test/ui/error-codes/e0119/auxiliary/issue-23563-a.rs25
-rw-r--r--src/test/ui/error-codes/e0119/complex-impl.rs12
-rw-r--r--src/test/ui/error-codes/e0119/complex-impl.stderr22
-rw-r--r--src/test/ui/error-codes/e0119/conflict-with-std.rs26
-rw-r--r--src/test/ui/error-codes/e0119/conflict-with-std.stderr32
-rw-r--r--src/test/ui/error-codes/e0119/issue-23563.rs29
-rw-r--r--src/test/ui/error-codes/e0119/issue-23563.stderr13
-rw-r--r--src/test/ui/error-codes/e0119/issue-27403.rs11
-rw-r--r--src/test/ui/error-codes/e0119/issue-27403.stderr13
-rw-r--r--src/test/ui/error-codes/e0119/issue-28981.rs8
-rw-r--r--src/test/ui/error-codes/e0119/issue-28981.stderr22
-rw-r--r--src/test/ui/error-codes/e0119/so-37347311.rs17
-rw-r--r--src/test/ui/error-codes/e0119/so-37347311.stderr12
44 files changed, 591 insertions, 0 deletions
diff --git a/src/test/ui/error-codes/E0501.rs b/src/test/ui/error-codes/E0501.rs
new file mode 100644
index 00000000000..3e39d9a63c5
--- /dev/null
+++ b/src/test/ui/error-codes/E0501.rs
@@ -0,0 +1,24 @@
+fn inside_closure(x: &mut i32) {
+}
+
+fn outside_closure_1(x: &mut i32) {
+}
+
+fn outside_closure_2(x: &i32) {
+}
+
+fn foo(a: &mut i32) {
+    let bar = || {
+        inside_closure(a)
+    };
+    outside_closure_1(a);
+    //~^ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
+
+    outside_closure_2(a);
+    //~^ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
+
+    drop(bar);
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0501.stderr b/src/test/ui/error-codes/E0501.stderr
new file mode 100644
index 00000000000..53d98d7e13f
--- /dev/null
+++ b/src/test/ui/error-codes/E0501.stderr
@@ -0,0 +1,31 @@
+error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
+  --> $DIR/E0501.rs:14:23
+   |
+LL |     let bar = || {
+   |               -- closure construction occurs here
+LL |         inside_closure(a)
+   |                        - first borrow occurs due to use of `a` in closure
+LL |     };
+LL |     outside_closure_1(a);
+   |                       ^ second borrow occurs here
+...
+LL |     drop(bar);
+   |          --- first borrow later used here
+
+error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
+  --> $DIR/E0501.rs:17:23
+   |
+LL |     let bar = || {
+   |               -- closure construction occurs here
+LL |         inside_closure(a)
+   |                        - first borrow occurs due to use of `a` in closure
+...
+LL |     outside_closure_2(a);
+   |                       ^ second borrow occurs here
+...
+LL |     drop(bar);
+   |          --- first borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0501`.
diff --git a/src/test/ui/error-codes/E0506.rs b/src/test/ui/error-codes/E0506.rs
new file mode 100644
index 00000000000..062a44a52bb
--- /dev/null
+++ b/src/test/ui/error-codes/E0506.rs
@@ -0,0 +1,11 @@
+struct FancyNum {
+    num: u8,
+}
+
+fn main() {
+    let mut fancy_num = FancyNum { num: 5 };
+    let fancy_ref = &fancy_num;
+    fancy_num = FancyNum { num: 6 }; //~ ERROR [E0506]
+
+    println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
+}
diff --git a/src/test/ui/error-codes/E0506.stderr b/src/test/ui/error-codes/E0506.stderr
new file mode 100644
index 00000000000..17f883f84b8
--- /dev/null
+++ b/src/test/ui/error-codes/E0506.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `fancy_num` because it is borrowed
+  --> $DIR/E0506.rs:8:5
+   |
+LL |     let fancy_ref = &fancy_num;
+   |                     ---------- borrow of `fancy_num` occurs here
+LL |     fancy_num = FancyNum { num: 6 };
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
+LL | 
+LL |     println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
+   |                                                 ------------- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/error-codes/E0508-fail.rs b/src/test/ui/error-codes/E0508-fail.rs
new file mode 100644
index 00000000000..072c3d66183
--- /dev/null
+++ b/src/test/ui/error-codes/E0508-fail.rs
@@ -0,0 +1,6 @@
+struct NonCopy;
+
+fn main() {
+    let array = [NonCopy; 1];
+    let _value = array[0];  //~ ERROR [E0508]
+}
diff --git a/src/test/ui/error-codes/E0508-fail.stderr b/src/test/ui/error-codes/E0508-fail.stderr
new file mode 100644
index 00000000000..63590bec32e
--- /dev/null
+++ b/src/test/ui/error-codes/E0508-fail.stderr
@@ -0,0 +1,12 @@
+error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
+  --> $DIR/E0508-fail.rs:5:18
+   |
+LL |     let _value = array[0];
+   |                  ^^^^^^^^
+   |                  |
+   |                  cannot move out of here
+   |                  help: consider borrowing here: `&array[0]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/error-codes/E0508.rs b/src/test/ui/error-codes/E0508.rs
new file mode 100644
index 00000000000..072c3d66183
--- /dev/null
+++ b/src/test/ui/error-codes/E0508.rs
@@ -0,0 +1,6 @@
+struct NonCopy;
+
+fn main() {
+    let array = [NonCopy; 1];
+    let _value = array[0];  //~ ERROR [E0508]
+}
diff --git a/src/test/ui/error-codes/E0508.stderr b/src/test/ui/error-codes/E0508.stderr
new file mode 100644
index 00000000000..983062e450e
--- /dev/null
+++ b/src/test/ui/error-codes/E0508.stderr
@@ -0,0 +1,12 @@
+error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
+  --> $DIR/E0508.rs:5:18
+   |
+LL |     let _value = array[0];
+   |                  ^^^^^^^^
+   |                  |
+   |                  cannot move out of here
+   |                  help: consider borrowing here: `&array[0]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/error-codes/E0583.rs b/src/test/ui/error-codes/E0583.rs
new file mode 100644
index 00000000000..969de79c058
--- /dev/null
+++ b/src/test/ui/error-codes/E0583.rs
@@ -0,0 +1,4 @@
+mod module_that_doesnt_exist; //~ ERROR E0583
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0583.stderr b/src/test/ui/error-codes/E0583.stderr
new file mode 100644
index 00000000000..ef7a48bc8a4
--- /dev/null
+++ b/src/test/ui/error-codes/E0583.stderr
@@ -0,0 +1,11 @@
+error[E0583]: file not found for module `module_that_doesnt_exist`
+  --> $DIR/E0583.rs:1:5
+   |
+LL | mod module_that_doesnt_exist;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: name the file either module_that_doesnt_exist.rs or module_that_doesnt_exist/mod.rs inside the directory "$DIR"
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0583`.
diff --git a/src/test/ui/error-codes/E0594.rs b/src/test/ui/error-codes/E0594.rs
new file mode 100644
index 00000000000..8b0cae7e17b
--- /dev/null
+++ b/src/test/ui/error-codes/E0594.rs
@@ -0,0 +1,5 @@
+static NUM: i32 = 18;
+
+fn main() {
+    NUM = 20; //~ ERROR cannot assign to immutable static item `NUM`
+}
diff --git a/src/test/ui/error-codes/E0594.stderr b/src/test/ui/error-codes/E0594.stderr
new file mode 100644
index 00000000000..c00ec4250a7
--- /dev/null
+++ b/src/test/ui/error-codes/E0594.stderr
@@ -0,0 +1,8 @@
+error[E0594]: cannot assign to immutable static item `NUM`
+  --> $DIR/E0594.rs:4:5
+   |
+LL |     NUM = 20;
+   |     ^^^^^^^^ cannot assign
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0596.rs b/src/test/ui/error-codes/E0596.rs
new file mode 100644
index 00000000000..9e2f5ee7636
--- /dev/null
+++ b/src/test/ui/error-codes/E0596.rs
@@ -0,0 +1,4 @@
+fn main() {
+    let x = 1;
+    let y = &mut x; //~ ERROR [E0596]
+}
diff --git a/src/test/ui/error-codes/E0596.stderr b/src/test/ui/error-codes/E0596.stderr
new file mode 100644
index 00000000000..79bc258f1fa
--- /dev/null
+++ b/src/test/ui/error-codes/E0596.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+  --> $DIR/E0596.rs:3:13
+   |
+LL |     let x = 1;
+   |         - help: consider changing this to be mutable: `mut x`
+LL |     let y = &mut x;
+   |             ^^^^^^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/error-codes/E0642.rs b/src/test/ui/error-codes/E0642.rs
new file mode 100644
index 00000000000..cfbd362c1da
--- /dev/null
+++ b/src/test/ui/error-codes/E0642.rs
@@ -0,0 +1,16 @@
+#[derive(Clone, Copy)]
+struct S;
+
+trait T {
+    fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
+
+    fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
+
+    fn method(S { .. }: S) {} //~ ERROR patterns aren't allowed in methods without bodies
+
+    fn f(&ident: &S) {} // ok
+    fn g(&&ident: &&S) {} // ok
+    fn h(mut ident: S) {} // ok
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0642.stderr b/src/test/ui/error-codes/E0642.stderr
new file mode 100644
index 00000000000..da255143494
--- /dev/null
+++ b/src/test/ui/error-codes/E0642.stderr
@@ -0,0 +1,33 @@
+error[E0642]: patterns aren't allowed in methods without bodies
+  --> $DIR/E0642.rs:5:12
+   |
+LL |     fn foo((x, y): (i32, i32));
+   |            ^^^^^^
+help: give this argument a name or use an underscore to ignore it
+   |
+LL |     fn foo(_: (i32, i32));
+   |            ^
+
+error[E0642]: patterns aren't allowed in methods without bodies
+  --> $DIR/E0642.rs:7:12
+   |
+LL |     fn bar((x, y): (i32, i32)) {}
+   |            ^^^^^^
+help: give this argument a name or use an underscore to ignore it
+   |
+LL |     fn bar(_: (i32, i32)) {}
+   |            ^
+
+error[E0642]: patterns aren't allowed in methods without bodies
+  --> $DIR/E0642.rs:9:15
+   |
+LL |     fn method(S { .. }: S) {}
+   |               ^^^^^^^^
+help: give this argument a name or use an underscore to ignore it
+   |
+LL |     fn method(_: S) {}
+   |               ^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0642`.
diff --git a/src/test/ui/error-codes/E0660.rs b/src/test/ui/error-codes/E0660.rs
new file mode 100644
index 00000000000..6280d390610
--- /dev/null
+++ b/src/test/ui/error-codes/E0660.rs
@@ -0,0 +1,9 @@
+#![feature(asm)]
+
+fn main() {
+    let a;
+    asm!("nop" "nop");
+    //~^ ERROR E0660
+    asm!("nop" "nop" : "=r"(a));
+    //~^ ERROR E0660
+}
diff --git a/src/test/ui/error-codes/E0660.stderr b/src/test/ui/error-codes/E0660.stderr
new file mode 100644
index 00000000000..ce34a9b01d7
--- /dev/null
+++ b/src/test/ui/error-codes/E0660.stderr
@@ -0,0 +1,14 @@
+error[E0660]: malformed inline assembly
+  --> $DIR/E0660.rs:5:5
+   |
+LL |     asm!("nop" "nop");
+   |     ^^^^^^^^^^^^^^^^^^
+
+error[E0660]: malformed inline assembly
+  --> $DIR/E0660.rs:7:5
+   |
+LL |     asm!("nop" "nop" : "=r"(a));
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/error-codes/E0661.rs b/src/test/ui/error-codes/E0661.rs
new file mode 100644
index 00000000000..8d355a8a021
--- /dev/null
+++ b/src/test/ui/error-codes/E0661.rs
@@ -0,0 +1,7 @@
+#![feature(asm)]
+
+fn main() {
+    let a;
+    asm!("nop" : "r"(a));
+    //~^ ERROR E0661
+}
diff --git a/src/test/ui/error-codes/E0661.stderr b/src/test/ui/error-codes/E0661.stderr
new file mode 100644
index 00000000000..30a23fd58c5
--- /dev/null
+++ b/src/test/ui/error-codes/E0661.stderr
@@ -0,0 +1,8 @@
+error[E0661]: output operand constraint lacks '=' or '+'
+  --> $DIR/E0661.rs:5:18
+   |
+LL |     asm!("nop" : "r"(a));
+   |                  ^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0662.rs b/src/test/ui/error-codes/E0662.rs
new file mode 100644
index 00000000000..7fe528c4745
--- /dev/null
+++ b/src/test/ui/error-codes/E0662.rs
@@ -0,0 +1,8 @@
+#![feature(asm)]
+
+fn main() {
+    asm!("xor %eax, %eax"
+         :
+         : "=test"("a") //~ ERROR E0662
+        );
+}
diff --git a/src/test/ui/error-codes/E0662.stderr b/src/test/ui/error-codes/E0662.stderr
new file mode 100644
index 00000000000..0d3701aa955
--- /dev/null
+++ b/src/test/ui/error-codes/E0662.stderr
@@ -0,0 +1,8 @@
+error[E0662]: input operand constraint contains '='
+  --> $DIR/E0662.rs:6:12
+   |
+LL |          : "=test"("a")
+   |            ^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0663.rs b/src/test/ui/error-codes/E0663.rs
new file mode 100644
index 00000000000..e5b8156cfb3
--- /dev/null
+++ b/src/test/ui/error-codes/E0663.rs
@@ -0,0 +1,8 @@
+#![feature(asm)]
+
+fn main() {
+    asm!("xor %eax, %eax"
+         :
+         : "+test"("a") //~ ERROR E0663
+        );
+}
diff --git a/src/test/ui/error-codes/E0663.stderr b/src/test/ui/error-codes/E0663.stderr
new file mode 100644
index 00000000000..46a079af152
--- /dev/null
+++ b/src/test/ui/error-codes/E0663.stderr
@@ -0,0 +1,8 @@
+error[E0663]: input operand constraint contains '+'
+  --> $DIR/E0663.rs:6:12
+   |
+LL |          : "+test"("a")
+   |            ^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0664.rs b/src/test/ui/error-codes/E0664.rs
new file mode 100644
index 00000000000..29ec7ced4fd
--- /dev/null
+++ b/src/test/ui/error-codes/E0664.rs
@@ -0,0 +1,9 @@
+#![feature(asm)]
+
+fn main() {
+    asm!("mov $$0x200, %eax"
+         :
+         :
+         : "{eax}" //~ ERROR E0664
+        );
+}
diff --git a/src/test/ui/error-codes/E0664.stderr b/src/test/ui/error-codes/E0664.stderr
new file mode 100644
index 00000000000..3a99fce6eed
--- /dev/null
+++ b/src/test/ui/error-codes/E0664.stderr
@@ -0,0 +1,8 @@
+error[E0664]: clobber should not be surrounded by braces
+  --> $DIR/E0664.rs:7:12
+   |
+LL |          : "{eax}"
+   |            ^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0665.rs b/src/test/ui/error-codes/E0665.rs
new file mode 100644
index 00000000000..cfd42bd9aac
--- /dev/null
+++ b/src/test/ui/error-codes/E0665.rs
@@ -0,0 +1,8 @@
+#[derive(Default)] //~ ERROR E0665
+enum Food {
+    Sweet,
+    Salty,
+}
+
+fn main() {
+}
diff --git a/src/test/ui/error-codes/E0665.stderr b/src/test/ui/error-codes/E0665.stderr
new file mode 100644
index 00000000000..84fe3c01394
--- /dev/null
+++ b/src/test/ui/error-codes/E0665.stderr
@@ -0,0 +1,8 @@
+error[E0665]: `Default` cannot be derived for enums, only structs
+  --> $DIR/E0665.rs:1:10
+   |
+LL | #[derive(Default)]
+   |          ^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0705.rs b/src/test/ui/error-codes/E0705.rs
new file mode 100644
index 00000000000..cc2b8f64d9f
--- /dev/null
+++ b/src/test/ui/error-codes/E0705.rs
@@ -0,0 +1,10 @@
+// compile-pass
+
+// This is a stub feature that doesn't control anything, so to make tidy happy,
+// gate-test-test_2018_feature
+
+#![feature(test_2018_feature)]
+//~^ WARN the feature `test_2018_feature` is included in the Rust 2018 edition
+#![feature(rust_2018_preview)]
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0705.stderr b/src/test/ui/error-codes/E0705.stderr
new file mode 100644
index 00000000000..1cb83f2e381
--- /dev/null
+++ b/src/test/ui/error-codes/E0705.stderr
@@ -0,0 +1,6 @@
+warning[E0705]: the feature `test_2018_feature` is included in the Rust 2018 edition
+  --> $DIR/E0705.rs:6:12
+   |
+LL | #![feature(test_2018_feature)]
+   |            ^^^^^^^^^^^^^^^^^
+
diff --git a/src/test/ui/error-codes/e0119/auxiliary/complex_impl_support.rs b/src/test/ui/error-codes/e0119/auxiliary/complex_impl_support.rs
new file mode 100644
index 00000000000..ad5bb107fc6
--- /dev/null
+++ b/src/test/ui/error-codes/e0119/auxiliary/complex_impl_support.rs
@@ -0,0 +1,22 @@
+use std::marker::PhantomData;
+
+pub trait External {}
+
+pub struct M<'a, 'b, 'c, T, U, V> {
+    a: PhantomData<&'a ()>,
+    b: PhantomData<&'b ()>,
+    c: PhantomData<&'c ()>,
+    d: PhantomData<T>,
+    e: PhantomData<U>,
+    f: PhantomData<V>,
+}
+
+impl<'a, 'b, 'c, T, U, V, W> External for (T, M<'a, 'b, 'c, Box<U>, V, W>)
+where
+    'b: 'a,
+    T: 'a,
+    U: (FnOnce(T) -> V) + 'static,
+    V: Iterator<Item=T> + Clone,
+    W: std::ops::Add,
+    W::Output: Copy,
+{}
diff --git a/src/test/ui/error-codes/e0119/auxiliary/issue-23563-a.rs b/src/test/ui/error-codes/e0119/auxiliary/issue-23563-a.rs
new file mode 100644
index 00000000000..4e85bcc4ba6
--- /dev/null
+++ b/src/test/ui/error-codes/e0119/auxiliary/issue-23563-a.rs
@@ -0,0 +1,25 @@
+// Ref: https://github.com/rust-lang/rust/issues/23563#issuecomment-260751672
+
+pub trait LolTo<T> {
+    fn convert_to(&self) -> T;
+}
+
+pub trait LolInto<T>: Sized {
+    fn convert_into(self) -> T;
+}
+
+pub trait LolFrom<T> {
+    fn from(T) -> Self;
+}
+
+impl<'a, T: ?Sized, U> LolInto<U> for &'a T where T: LolTo<U> {
+    fn convert_into(self) -> U {
+        self.convert_to()
+    }
+}
+
+impl<T, U> LolFrom<T> for U where T: LolInto<U> {
+    fn from(t: T) -> U {
+        t.convert_into()
+    }
+}
diff --git a/src/test/ui/error-codes/e0119/complex-impl.rs b/src/test/ui/error-codes/e0119/complex-impl.rs
new file mode 100644
index 00000000000..3cba39ecbf9
--- /dev/null
+++ b/src/test/ui/error-codes/e0119/complex-impl.rs
@@ -0,0 +1,12 @@
+// aux-build:complex_impl_support.rs
+
+extern crate complex_impl_support;
+
+use complex_impl_support::{External, M};
+
+struct Q;
+
+impl<R> External for (Q, R) {} //~ ERROR must be used
+//~^ ERROR conflicting implementations of trait
+
+fn main() {}
diff --git a/src/test/ui/error-codes/e0119/complex-impl.stderr b/src/test/ui/error-codes/e0119/complex-impl.stderr
new file mode 100644
index 00000000000..7ed89a5b1ae
--- /dev/null
+++ b/src/test/ui/error-codes/e0119/complex-impl.stderr
@@ -0,0 +1,22 @@
+error[E0119]: conflicting implementations of trait `complex_impl_support::External` for type `(Q, complex_impl_support::M<'_, '_, '_, std::boxed::Box<_>, _, _>)`:
+  --> $DIR/complex-impl.rs:9:1
+   |
+LL | impl<R> External for (Q, R) {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: conflicting implementation in crate `complex_impl_support`:
+           - impl<'a, 'b, 'c, T, U, V, W> complex_impl_support::External for (T, complex_impl_support::M<'a, 'b, 'c, std::boxed::Box<U>, V, W>)
+             where <U as std::ops::FnOnce<(T,)>>::Output == V, <V as std::iter::Iterator>::Item == T, 'b : 'a, T : 'a, U: std::ops::FnOnce<(T,)>, U : 'static, V: std::iter::Iterator, V: std::clone::Clone, W: std::ops::Add, <W as std::ops::Add>::Output: std::marker::Copy;
+
+error[E0210]: type parameter `R` must be used as the type parameter for some local type (e.g., `MyStruct<R>`)
+  --> $DIR/complex-impl.rs:9:1
+   |
+LL | impl<R> External for (Q, R) {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `R` 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
+
+Some errors have detailed explanations: E0119, E0210.
+For more information about an error, try `rustc --explain E0119`.
diff --git a/src/test/ui/error-codes/e0119/conflict-with-std.rs b/src/test/ui/error-codes/e0119/conflict-with-std.rs
new file mode 100644
index 00000000000..c9db2bab183
--- /dev/null
+++ b/src/test/ui/error-codes/e0119/conflict-with-std.rs
@@ -0,0 +1,26 @@
+use std::marker::PhantomData;
+use std::convert::{TryFrom, AsRef};
+
+struct Q;
+impl AsRef<Q> for Box<Q> { //~ ERROR conflicting implementations
+    fn as_ref(&self) -> &Q {
+        &**self
+    }
+}
+
+struct S;
+impl From<S> for S { //~ ERROR conflicting implementations
+    fn from(s: S) -> S {
+        s
+    }
+}
+
+struct X;
+impl TryFrom<X> for X { //~ ERROR conflicting implementations
+    type Error = ();
+    fn try_from(u: X) -> Result<X, ()> {
+        Ok(u)
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/e0119/conflict-with-std.stderr b/src/test/ui/error-codes/e0119/conflict-with-std.stderr
new file mode 100644
index 00000000000..3e0c71e9074
--- /dev/null
+++ b/src/test/ui/error-codes/e0119/conflict-with-std.stderr
@@ -0,0 +1,32 @@
+error[E0119]: conflicting implementations of trait `std::convert::AsRef<Q>` for type `std::boxed::Box<Q>`:
+  --> $DIR/conflict-with-std.rs:5:1
+   |
+LL | impl AsRef<Q> for Box<Q> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: conflicting implementation in crate `alloc`:
+           - impl<T> std::convert::AsRef<T> for std::boxed::Box<T>
+             where T: ?Sized;
+
+error[E0119]: conflicting implementations of trait `std::convert::From<S>` for type `S`:
+  --> $DIR/conflict-with-std.rs:12:1
+   |
+LL | impl From<S> for S {
+   | ^^^^^^^^^^^^^^^^^^
+   |
+   = note: conflicting implementation in crate `core`:
+           - impl<T> std::convert::From<T> for T;
+
+error[E0119]: conflicting implementations of trait `std::convert::TryFrom<X>` for type `X`:
+  --> $DIR/conflict-with-std.rs:19:1
+   |
+LL | impl TryFrom<X> for X {
+   | ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: conflicting implementation in crate `core`:
+           - impl<T, U> std::convert::TryFrom<U> for T
+             where U: std::convert::Into<T>;
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/ui/error-codes/e0119/issue-23563.rs b/src/test/ui/error-codes/e0119/issue-23563.rs
new file mode 100644
index 00000000000..f578560c552
--- /dev/null
+++ b/src/test/ui/error-codes/e0119/issue-23563.rs
@@ -0,0 +1,29 @@
+// aux-build:issue-23563-a.rs
+
+// Ref: https://github.com/rust-lang/rust/issues/23563#issuecomment-260751672
+
+extern crate issue_23563_a as a;
+
+use a::LolFrom;
+use a::LolInto;
+use a::LolTo;
+
+struct LocalType<T>(Option<T>);
+
+impl<'a, T> LolFrom<&'a [T]> for LocalType<T> { //~ ERROR conflicting implementations of trait
+    fn from(_: &'a [T]) -> LocalType<T> { LocalType(None) }
+}
+
+impl<T> LolInto<LocalType<T>> for LocalType<T> {
+    fn convert_into(self) -> LocalType<T> {
+        self
+    }
+}
+
+impl LolTo<LocalType<u8>> for [u8] {
+    fn convert_to(&self) -> LocalType<u8> {
+        LocalType(None)
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/e0119/issue-23563.stderr b/src/test/ui/error-codes/e0119/issue-23563.stderr
new file mode 100644
index 00000000000..8011689880d
--- /dev/null
+++ b/src/test/ui/error-codes/e0119/issue-23563.stderr
@@ -0,0 +1,13 @@
+error[E0119]: conflicting implementations of trait `a::LolFrom<&[_]>` for type `LocalType<_>`:
+  --> $DIR/issue-23563.rs:13:1
+   |
+LL | impl<'a, T> LolFrom<&'a [T]> for LocalType<T> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: conflicting implementation in crate `issue_23563_a`:
+           - impl<T, U> a::LolFrom<T> for U
+             where T: a::LolInto<U>;
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/ui/error-codes/e0119/issue-27403.rs b/src/test/ui/error-codes/e0119/issue-27403.rs
new file mode 100644
index 00000000000..b03a564ffd4
--- /dev/null
+++ b/src/test/ui/error-codes/e0119/issue-27403.rs
@@ -0,0 +1,11 @@
+pub struct GenX<S> {
+    inner: S,
+}
+
+impl<S> Into<S> for GenX<S> { //~ ERROR conflicting implementations
+    fn into(self) -> S {
+        self.inner
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/e0119/issue-27403.stderr b/src/test/ui/error-codes/e0119/issue-27403.stderr
new file mode 100644
index 00000000000..cba10432a93
--- /dev/null
+++ b/src/test/ui/error-codes/e0119/issue-27403.stderr
@@ -0,0 +1,13 @@
+error[E0119]: conflicting implementations of trait `std::convert::Into<_>` for type `GenX<_>`:
+  --> $DIR/issue-27403.rs:5:1
+   |
+LL | impl<S> Into<S> for GenX<S> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: conflicting implementation in crate `core`:
+           - impl<T, U> std::convert::Into<U> for T
+             where U: std::convert::From<T>;
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/ui/error-codes/e0119/issue-28981.rs b/src/test/ui/error-codes/e0119/issue-28981.rs
new file mode 100644
index 00000000000..c31b212b25a
--- /dev/null
+++ b/src/test/ui/error-codes/e0119/issue-28981.rs
@@ -0,0 +1,8 @@
+use std::ops::Deref;
+
+struct Foo;
+
+impl<Foo> Deref for Foo { } //~ ERROR must be used
+//~^ ERROR conflicting implementations
+
+fn main() {}
diff --git a/src/test/ui/error-codes/e0119/issue-28981.stderr b/src/test/ui/error-codes/e0119/issue-28981.stderr
new file mode 100644
index 00000000000..70c83e1412d
--- /dev/null
+++ b/src/test/ui/error-codes/e0119/issue-28981.stderr
@@ -0,0 +1,22 @@
+error[E0119]: conflicting implementations of trait `std::ops::Deref` for type `&_`:
+  --> $DIR/issue-28981.rs:5:1
+   |
+LL | impl<Foo> Deref for Foo { }
+   | ^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: conflicting implementation in crate `core`:
+           - impl<T> std::ops::Deref for &T
+             where T: ?Sized;
+
+error[E0210]: type parameter `Foo` must be used as the type parameter for some local type (e.g., `MyStruct<Foo>`)
+  --> $DIR/issue-28981.rs:5:1
+   |
+LL | impl<Foo> Deref for Foo { }
+   | ^^^^^^^^^^^^^^^^^^^^^^^ type parameter `Foo` 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
+
+Some errors have detailed explanations: E0119, E0210.
+For more information about an error, try `rustc --explain E0119`.
diff --git a/src/test/ui/error-codes/e0119/so-37347311.rs b/src/test/ui/error-codes/e0119/so-37347311.rs
new file mode 100644
index 00000000000..d5f624bc4d9
--- /dev/null
+++ b/src/test/ui/error-codes/e0119/so-37347311.rs
@@ -0,0 +1,17 @@
+// Ref: https://stackoverflow.com/q/37347311
+
+trait Storage {
+    type Error;
+}
+
+enum MyError<S: Storage> {
+    StorageProblem(S::Error),
+}
+
+impl<S: Storage> From<S::Error> for MyError<S> { //~ ERROR conflicting implementations
+    fn from(error: S::Error) -> MyError<S> {
+        MyError::StorageProblem(error)
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/e0119/so-37347311.stderr b/src/test/ui/error-codes/e0119/so-37347311.stderr
new file mode 100644
index 00000000000..f2166de71f8
--- /dev/null
+++ b/src/test/ui/error-codes/e0119/so-37347311.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `std::convert::From<MyError<_>>` for type `MyError<_>`:
+  --> $DIR/so-37347311.rs:11:1
+   |
+LL | impl<S: Storage> From<S::Error> for MyError<S> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: conflicting implementation in crate `core`:
+           - impl<T> std::convert::From<T> for T;
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.