summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-05-16 20:12:17 +0200
committerGitHub <noreply@github.com>2023-05-16 20:12:17 +0200
commit6dc365003bce4cdc11e73fcfe4c61c6da56acd65 (patch)
tree5ba226a580143e2e73db8d6628432780fe322a8a /tests
parent426dbcdf9208ff7c58b248e8adb4e933babd8ab1 (diff)
parentbd31d9ee9c772e10fb256ba177b738170862ac9e (diff)
downloadrust-6dc365003bce4cdc11e73fcfe4c61c6da56acd65.tar.gz
Rollup merge of #111573 - compiler-errors:erase-re-error, r=WaffleLapkin
Erase `ReError` properly Fixes #111341 Since we check whether a type has free regions before erasing (to short circuit unnecesary folding), we need to consider `ReError` as a free region, or else we'll skip it when erasing a type that only mentions `ReError`. cc `@nnethercote`
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs23
-rw-r--r--tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr24
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs b/tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs
new file mode 100644
index 00000000000..addbe5d658a
--- /dev/null
+++ b/tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs
@@ -0,0 +1,23 @@
+// compile-flags: -Zdrop-tracking-mir
+// edition:2021
+
+use std::future::Future;
+
+trait Client {
+ type Connecting<'a>: Future + Send
+ where
+ Self: 'a;
+
+ fn connect(&'_ self) -> Self::Connecting<'a>;
+ //~^ ERROR use of undeclared lifetime name `'a`
+}
+
+fn call_connect<C>(c: &'_ C) -> impl '_ + Future + Send
+where
+ C: Client + Send + Sync,
+{
+ async move { c.connect().await }
+ //~^ ERROR `C` does not live long enough
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr b/tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr
new file mode 100644
index 00000000000..53abe3dc952
--- /dev/null
+++ b/tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr
@@ -0,0 +1,24 @@
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/erase-error-in-mir-drop-tracking.rs:11:46
+ |
+LL | fn connect(&'_ self) -> Self::Connecting<'a>;
+ | ^^ undeclared lifetime
+ |
+help: consider introducing lifetime `'a` here
+ |
+LL | fn connect<'a>(&'_ self) -> Self::Connecting<'a>;
+ | ++++
+help: consider introducing lifetime `'a` here
+ |
+LL | trait Client<'a> {
+ | ++++
+
+error: `C` does not live long enough
+ --> $DIR/erase-error-in-mir-drop-tracking.rs:19:5
+ |
+LL | async move { c.connect().await }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0261`.