]> git.lizzy.rs Git - rust.git/blobdiff - tests/source/type.rs
fix internal error for long closure types (#3653)
[rust.git] / tests / source / type.rs
index 0a46ffb2ee4a1f3da8b56dfde1626f905d8250cd..27387c5bdcace31c89ef15b40c7ee40c36cc0640 100644 (file)
@@ -23,3 +23,119 @@ fn impl_trait_fn_2<E>() -> impl Future<Item=&'a i64,Error=E> {}
 fn issue_1234() {
     do_parse!(name: take_while1!(is_token) >> (Header))
 }
+
+// #2510
+impl CombineTypes {
+    pub fn pop_callback(
+        &self,
+        query_id: Uuid,
+    ) -> Option<
+        (
+            ProjectId,
+            Box<FnMut(&ProjectState, serde_json::Value, bool) -> () + Sync + Send>,
+        ),
+    > {
+        self.query_callbacks()(&query_id)
+    }
+}
+
+// #2859
+pub fn do_something<'a, T: Trait1 + Trait2 + 'a>(&fooo: u32) -> impl Future<
+    Item = (
+        impl Future<Item = (
+        ), Error =   SomeError> + 'a,
+        impl Future<Item = (), Error = SomeError> + 'a,
+impl Future<Item = (), Error = SomeError > + 'a,
+    ),
+    Error = SomeError,
+    >
+    +
+    'a {
+}
+
+pub fn do_something<'a, T: Trait1 + Trait2 + 'a>(    &fooo: u32,
+) -> impl Future<
+    Item = (
+impl Future<Item = (), Error = SomeError> + 'a,
+        impl Future<Item = (), Error = SomeError> + 'a,
+        impl Future<Item = (), Error = SomeError> + 'a,
+    ),
+    Error = SomeError,
+    >
+    + Future<
+    Item = (
+        impl Future<Item = (), Error = SomeError> + 'a,
+impl Future<Item = (), Error = SomeError> + 'a,
+        impl Future<Item = (), Error = SomeError> + 'a,
+    ),
+    Error = SomeError,
+        >
+    + Future<
+    Item = (
+        impl Future<Item = (), Error = SomeError> + 'a,
+   impl Future<Item = (), Error = SomeError> + 'a,
+        impl Future<Item = (), Error = SomeError> + 'a,
+    ),
+    Error = SomeError,
+        >
+    +
+    'a + 'b +
+    'c {
+}
+
+// #3051
+token![impl];
+token![ impl ];
+
+// #3060
+macro_rules! foo {
+    ($foo_api: ty) => {
+        type Target = ( $foo_api ) + 'static;
+    }
+}
+
+type Target = ( FooAPI ) + 'static;
+
+// #3137
+fn foo<T>(t: T)
+where
+    T: ( FnOnce() -> () ) + Clone,
+    U: ( FnOnce() -> () ) + 'static,
+{
+}
+
+// #3117
+fn issue3117() {
+    {
+        {
+            {
+                {
+                    {
+                        {
+                            {
+                                {
+                                    let opt: &mut Option<MyLongTypeHere> =
+                                        unsafe { &mut *self.future.get() };
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+
+// #3139
+fn issue3139() {
+    assert_eq!(
+        to_json_value(&None ::  <i32>).unwrap(),
+        json!(  { "test": None  ::  <i32> }  )
+    );
+}
+
+// #3180
+fn foo(a: SomeLongComplexType, b: SomeOtherLongComplexType) -> Box<Future<Item = AnotherLongType, Error = ALongErrorType>> {
+}
+
+type MyFn = fn(a: SomeLongComplexType, b: SomeOtherLongComplexType,) -> Box<Future<Item = AnotherLongType, Error = ALongErrorType>>;