about summary refs log tree commit diff
path: root/tests/ui/traits/trait-upcasting/illegal-upcast-to-impl-opaque.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits/trait-upcasting/illegal-upcast-to-impl-opaque.rs')
-rw-r--r--tests/ui/traits/trait-upcasting/illegal-upcast-to-impl-opaque.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/traits/trait-upcasting/illegal-upcast-to-impl-opaque.rs b/tests/ui/traits/trait-upcasting/illegal-upcast-to-impl-opaque.rs
new file mode 100644
index 00000000000..5820e49a4e5
--- /dev/null
+++ b/tests/ui/traits/trait-upcasting/illegal-upcast-to-impl-opaque.rs
@@ -0,0 +1,28 @@
+//@ revisions: current next
+//@[next] compile-flags: -Znext-solver
+//@[next] failure-status: 101
+//@[next] known-bug: unknown
+//@[next] normalize-stderr-test "note: .*\n\n" -> ""
+//@[next] normalize-stderr-test "thread 'rustc' panicked.*\n.*\n" -> ""
+//@[next] normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
+//@[next] normalize-stderr-test "delayed at .*" -> ""
+//@[next] rustc-env:RUST_BACKTRACE=0
+//@ check-pass
+
+#![feature(trait_upcasting)]
+
+trait Super {
+    type Assoc;
+}
+
+trait Sub: Super {}
+
+impl<T: ?Sized> Super for T {
+    type Assoc = i32;
+}
+
+fn illegal(x: &dyn Sub<Assoc = i32>) -> &dyn Super<Assoc = impl Sized> {
+    x
+}
+
+fn main() {}