about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/borrowck/bad-drop-side-effects.rs18
-rw-r--r--tests/ui/borrowck/bad-drop-side-effects.stderr9
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/borrowck/bad-drop-side-effects.rs b/tests/ui/borrowck/bad-drop-side-effects.rs
new file mode 100644
index 00000000000..a09b7087608
--- /dev/null
+++ b/tests/ui/borrowck/bad-drop-side-effects.rs
@@ -0,0 +1,18 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/137288>.
+
+trait B {
+    type C;
+}
+
+impl<U> B for &Missing {
+//~^ ERROR cannot find type `Missing` in this scope
+    type C = ();
+}
+
+struct E<T: B> {
+    g: <T as B>::C,
+}
+
+fn h(i: Box<E<&()>>) {}
+
+fn main() {}
diff --git a/tests/ui/borrowck/bad-drop-side-effects.stderr b/tests/ui/borrowck/bad-drop-side-effects.stderr
new file mode 100644
index 00000000000..0a5998c7e48
--- /dev/null
+++ b/tests/ui/borrowck/bad-drop-side-effects.stderr
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type `Missing` in this scope
+  --> $DIR/bad-drop-side-effects.rs:7:16
+   |
+LL | impl<U> B for &Missing {
+   |                ^^^^^^^ not found in this scope
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0412`.