about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-04-13 19:22:14 +0000
committerbors <bors@rust-lang.org>2018-04-13 19:22:14 +0000
commit7291829268ced93054aa74072b074799e0e563e3 (patch)
tree47bbbcbdd6ccdebca4027e6dfc06d561b9c98852 /src/test
parent9c2bfcbea2d7fff10e608b495d76f24f441999b9 (diff)
parent378bd4967c4f1c5fac87515b052435fa7554eecc (diff)
downloadrust-7291829268ced93054aa74072b074799e0e563e3.tar.gz
rust-7291829268ced93054aa74072b074799e0e563e3.zip
Auto merge of #49830 - sinkuu:fix_ice_47715, r=cramertj
Fix ICE by disallowing `impl Trait` in unsupported position

Fixes #47715.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/issue-47715.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-47715.rs b/src/test/compile-fail/issue-47715.rs
new file mode 100644
index 00000000000..b6b720f088a
--- /dev/null
+++ b/src/test/compile-fail/issue-47715.rs
@@ -0,0 +1,38 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {}
+
+trait Bar<T> {}
+
+trait Iterable {
+    type Item;
+}
+
+struct Container<T: Iterable<Item = impl Foo>> {
+    //~^ ERROR `impl Trait` not allowed
+    field: T
+}
+
+enum Enum<T: Iterable<Item = impl Foo>> {
+    //~^ ERROR `impl Trait` not allowed
+    A(T),
+}
+
+union Union<T: Iterable<Item = impl Foo> + Copy> {
+    //~^ ERROR `impl Trait` not allowed
+    x: T,
+}
+
+type Type<T: Iterable<Item = impl Foo>> = T;
+//~^ ERROR `impl Trait` not allowed
+
+fn main() {
+}