]> git.lizzy.rs Git - rust.git/commitdiff
Add an explicit test for issue #50582
authorJosh Stone <jistone@redhat.com>
Mon, 4 Mar 2019 21:28:31 +0000 (13:28 -0800)
committerJosh Stone <jistone@redhat.com>
Mon, 4 Mar 2019 21:28:31 +0000 (13:28 -0800)
This code no longer ICEs, and @yodaldevoid found that it was fixed by
commit fe5710a. While that added a similar test, we can explicitly test
this reproducer too.

Closes #50582.

src/test/ui/issues/issue-50582.rs [new file with mode: 0644]
src/test/ui/issues/issue-50582.stderr [new file with mode: 0644]

diff --git a/src/test/ui/issues/issue-50582.rs b/src/test/ui/issues/issue-50582.rs
new file mode 100644 (file)
index 0000000..1358e0b
--- /dev/null
@@ -0,0 +1,4 @@
+fn main() {
+    Vec::<[(); 1 + for x in 0..1 {}]>::new();
+    //~^ ERROR cannot add
+}
diff --git a/src/test/ui/issues/issue-50582.stderr b/src/test/ui/issues/issue-50582.stderr
new file mode 100644 (file)
index 0000000..226f5a3
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0277]: cannot add `()` to `{integer}`
+  --> $DIR/issue-50582.rs:2:18
+   |
+LL |     Vec::<[(); 1 + for x in 0..1 {}]>::new();
+   |                  ^ no implementation for `{integer} + ()`
+   |
+   = help: the trait `std::ops::Add<()>` is not implemented for `{integer}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.