summaryrefslogtreecommitdiffstats
path: root/tests/ui/associated-inherent-types/bugs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/associated-inherent-types/bugs')
-rw-r--r--tests/ui/associated-inherent-types/bugs/ice-substitution.rs23
-rw-r--r--tests/ui/associated-inherent-types/bugs/ice-substitution.stderr6
-rw-r--r--tests/ui/associated-inherent-types/bugs/inference-fail.rs15
-rw-r--r--tests/ui/associated-inherent-types/bugs/inference-fail.stderr9
-rw-r--r--tests/ui/associated-inherent-types/bugs/lack-of-regionck.rs19
5 files changed, 72 insertions, 0 deletions
diff --git a/tests/ui/associated-inherent-types/bugs/ice-substitution.rs b/tests/ui/associated-inherent-types/bugs/ice-substitution.rs
new file mode 100644
index 000000000..53ac79e05
--- /dev/null
+++ b/tests/ui/associated-inherent-types/bugs/ice-substitution.rs
@@ -0,0 +1,23 @@
+// known-bug: unknown
+// failure-status: 101
+// normalize-stderr-test "note: .*\n\n" -> ""
+// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
+// rustc-env:RUST_BACKTRACE=0
+
+// FIXME: I presume a type variable that couldn't be solved by `resolve_vars_if_possible`
+// escapes the InferCtxt snapshot.
+
+#![feature(inherent_associated_types)]
+#![allow(incomplete_features)]
+
+struct Cont<T>(T);
+
+impl<T: Copy> Cont<T> {
+ type Out = Vec<T>;
+}
+
+pub fn weird<T: Copy>(x: T) {
+ let _: Cont<_>::Out = vec![true];
+}
+
+fn main() {}
diff --git a/tests/ui/associated-inherent-types/bugs/ice-substitution.stderr b/tests/ui/associated-inherent-types/bugs/ice-substitution.stderr
new file mode 100644
index 000000000..7b0d1c505
--- /dev/null
+++ b/tests/ui/associated-inherent-types/bugs/ice-substitution.stderr
@@ -0,0 +1,6 @@
+error: the compiler unexpectedly panicked. this is a bug.
+
+query stack during panic:
+#0 [typeck] type-checking `weird`
+#1 [typeck_item_bodies] type-checking all item bodies
+end of query stack
diff --git a/tests/ui/associated-inherent-types/bugs/inference-fail.rs b/tests/ui/associated-inherent-types/bugs/inference-fail.rs
new file mode 100644
index 000000000..a920b412b
--- /dev/null
+++ b/tests/ui/associated-inherent-types/bugs/inference-fail.rs
@@ -0,0 +1,15 @@
+// known-bug: unknown
+
+#![feature(inherent_associated_types)]
+#![allow(incomplete_features)]
+
+struct S<T>(T);
+
+impl S<()> {
+ type P = i128;
+}
+
+fn main() {
+ // We fail to infer `_ == ()` here.
+ let _: S<_>::P;
+}
diff --git a/tests/ui/associated-inherent-types/bugs/inference-fail.stderr b/tests/ui/associated-inherent-types/bugs/inference-fail.stderr
new file mode 100644
index 000000000..425691bd6
--- /dev/null
+++ b/tests/ui/associated-inherent-types/bugs/inference-fail.stderr
@@ -0,0 +1,9 @@
+error[E0282]: type annotations needed
+ --> $DIR/inference-fail.rs:14:14
+ |
+LL | let _: S<_>::P;
+ | ^ cannot infer type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/associated-inherent-types/bugs/lack-of-regionck.rs b/tests/ui/associated-inherent-types/bugs/lack-of-regionck.rs
new file mode 100644
index 000000000..632dbf385
--- /dev/null
+++ b/tests/ui/associated-inherent-types/bugs/lack-of-regionck.rs
@@ -0,0 +1,19 @@
+// known-bug: unknown
+// check-pass
+
+// We currently don't region-check inherent associated type projections at all.
+
+#![feature(inherent_associated_types)]
+#![allow(incomplete_features, dead_code)]
+
+struct S<T>(T);
+
+impl S<&'static ()> {
+ type T = ();
+}
+
+fn usr<'a>() {
+ let _: S::<&'a ()>::T; // this should *fail* but it doesn't!
+}
+
+fn main() {}