about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjsirs <44773712+jsirs@users.noreply.github.com>2018-11-05 14:33:43 +0200
committerGitHub <noreply@github.com>2018-11-05 14:33:43 +0200
commit2a1dc1eff62313bfa37eef6a2681269bda5f8439 (patch)
tree8e75bbb3f0a758314f5ea6cb89a44fec220cd54a
parent56ac2c4fc3a287c189abb2db5fd26a53f30ef9e7 (diff)
downloadrust-2a1dc1eff62313bfa37eef6a2681269bda5f8439.tar.gz
rust-2a1dc1eff62313bfa37eef6a2681269bda5f8439.zip
Add test
Add test for incompleately implemented add trait, see issue #31076
-rw-r--r--src/test/ui/issues/issue-31076.rs15
-rw-r--r--src/test/ui/issues/issue-31076.stderr11
2 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-31076.rs b/src/test/ui/issues/issue-31076.rs
new file mode 100644
index 00000000000..3d235720c38
--- /dev/null
+++ b/src/test/ui/issues/issue-31076.rs
@@ -0,0 +1,15 @@
+#![feature(no_core, lang_items)]
+#![no_core]
+
+#[lang="sized"]
+trait Sized {}
+
+#[lang="add"]
+trait Add<T> {}
+
+impl Add<i32> for i32 {}
+
+fn main() {
+    let x = 5 + 6;
+    //~^ ERROR binary operation `+` cannot be applied to type `{integer}`
+}
diff --git a/src/test/ui/issues/issue-31076.stderr b/src/test/ui/issues/issue-31076.stderr
new file mode 100644
index 00000000000..a667034bd8c
--- /dev/null
+++ b/src/test/ui/issues/issue-31076.stderr
@@ -0,0 +1,11 @@
+error[E0369]: binary operation `+` cannot be applied to type `{integer}`
+  --> $DIR/typeck-issue-31076-correct-trait-impl.rs:13:13
+   |
+LL |     let x = 5 + 6;
+   |             ^^^^^
+   |
+   = note: an implementation of `std::ops::Add` might be missing for `{integer}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.