about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.rs8
-rw-r--r--tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.stderr11
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.rs b/tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.rs
new file mode 100644
index 00000000000..8eaa0c9194a
--- /dev/null
+++ b/tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.rs
@@ -0,0 +1,8 @@
+// E0116 caused other unrelated errors, so check no unrelated errors are emmitted.
+
+fn main() {
+    let x = "hello";
+    x.split(" ");
+}
+
+impl Vec<usize> {} //~ ERROR E0116
diff --git a/tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.stderr b/tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.stderr
new file mode 100644
index 00000000000..2a33262f838
--- /dev/null
+++ b/tests/ui/incoherent-inherent-impls/no-other-unrelated-errors.stderr
@@ -0,0 +1,11 @@
+error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined
+  --> $DIR/no-other-unrelated-errors.rs:8:1
+   |
+LL | impl Vec<usize> {}
+   | ^^^^^^^^^^^^^^^ impl for type defined outside of crate
+   |
+   = note: define and implement a trait or new type instead
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0116`.