summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-16668.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/issues/issue-16668.rs')
-rw-r--r--tests/ui/issues/issue-16668.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-16668.rs b/tests/ui/issues/issue-16668.rs
new file mode 100644
index 000000000..92efb42fe
--- /dev/null
+++ b/tests/ui/issues/issue-16668.rs
@@ -0,0 +1,20 @@
+// check-pass
+#![allow(dead_code)]
+struct Parser<'a, I, O> {
+ parse: Box<dyn FnMut(I) -> Result<O, String> + 'a>
+}
+
+impl<'a, I: 'a, O: 'a> Parser<'a, I, O> {
+ fn compose<K: 'a>(mut self, mut rhs: Parser<'a, O, K>) -> Parser<'a, I, K> {
+ Parser {
+ parse: Box::new(move |x: I| {
+ match (self.parse)(x) {
+ Ok(r) => (rhs.parse)(r),
+ Err(e) => Err(e)
+ }
+ })
+ }
+ }
+}
+
+fn main() {}