about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/variance/type-resolve-error-two-structs-deep.rs13
-rw-r--r--tests/ui/variance/type-resolve-error-two-structs-deep.stderr9
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/variance/type-resolve-error-two-structs-deep.rs b/tests/ui/variance/type-resolve-error-two-structs-deep.rs
new file mode 100644
index 00000000000..47ec532ab96
--- /dev/null
+++ b/tests/ui/variance/type-resolve-error-two-structs-deep.rs
@@ -0,0 +1,13 @@
+// Make sure we don't report bivariance errors when nesting structs w/ unresolved
+// fields into *other* structs.
+
+struct Hello<'a> {
+    missing: Missing<'a>,
+    //~^ ERROR cannot find type `Missing` in this scope
+}
+
+struct Other<'a> {
+    hello: Hello<'a>,
+}
+
+fn main() {}
diff --git a/tests/ui/variance/type-resolve-error-two-structs-deep.stderr b/tests/ui/variance/type-resolve-error-two-structs-deep.stderr
new file mode 100644
index 00000000000..3458d924bb1
--- /dev/null
+++ b/tests/ui/variance/type-resolve-error-two-structs-deep.stderr
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type `Missing` in this scope
+  --> $DIR/type-resolve-error-two-structs-deep.rs:5:14
+   |
+LL |     missing: Missing<'a>,
+   |              ^^^^^^^ not found in this scope
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0412`.