about summary refs log tree commit diff
path: root/tests/ui/implied-bounds
diff options
context:
space:
mode:
authorAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2023-03-26 14:37:24 +0300
committerAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2023-03-26 14:37:24 +0300
commit2a3177a8bcc4c5a5285dc2908a0f1ce98e9a6377 (patch)
treea8bfe6e34ada1a16d6ed93c33b9bd41e401a88af /tests/ui/implied-bounds
parentb20aa97d480fd6917f88f26b2b038bd1c06bd9da (diff)
downloadrust-2a3177a8bcc4c5a5285dc2908a0f1ce98e9a6377.tar.gz
rust-2a3177a8bcc4c5a5285dc2908a0f1ce98e9a6377.zip
tolerate region vars in implied bounds
See https://github.com/rust-lang/rust/issues/109628.
Diffstat (limited to 'tests/ui/implied-bounds')
-rw-r--r--tests/ui/implied-bounds/ice-unbound-region-vars.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/implied-bounds/ice-unbound-region-vars.rs b/tests/ui/implied-bounds/ice-unbound-region-vars.rs
new file mode 100644
index 00000000000..9e1e3feaeec
--- /dev/null
+++ b/tests/ui/implied-bounds/ice-unbound-region-vars.rs
@@ -0,0 +1,24 @@
+// Because of #109628, we can have unbounded region vars in implied bounds.
+// Make sure we don't ICE in this case!
+//
+// check-pass
+
+pub trait MapAccess {
+    type Error;
+    fn next_key_seed(&mut self) -> Option<Self::Error>;
+}
+
+struct Access<'a> {
+    _marker: std::marker::PhantomData<&'a ()>,
+}
+
+// implied_bounds(Option<Self::Error>) = ['?1: 'a, ]
+// where '?1 is a fresh region var.
+impl<'a, 'b: 'a> MapAccess for Access<'a> {
+    type Error = ();
+    fn next_key_seed(&mut self) -> Option<Self::Error> {
+        unimplemented!()
+    }
+}
+
+fn main() {}