]> git.lizzy.rs Git - rust.git/blobdiff - tests/target/impls.rs
Tidy up and pass tests
[rust.git] / tests / target / impls.rs
index cc60b8227944917f48389241623b157c1394139c..91172b39fe593be5337a3e08dac05856c297d34b 100644 (file)
@@ -1,3 +1,4 @@
+// rustfmt-normalize_comments: true
 impl Foo for Bar {
     fn foo() {
         "hi"
@@ -5,6 +6,10 @@ fn foo() {
 }
 
 pub impl Foo for Bar {
+    // Associated Constants
+    const Baz: i32 = 16;
+    // Associated Types
+    type FooBar = usize;
     // Comment 1
     fn foo() {
         "hi"
@@ -16,7 +21,9 @@ fn foo() {
     // Comment 3
 }
 
-pub unsafe impl<'a, 'b, X, Y: Foo<Bar>> !Foo<'a, X> for Bar<'b, Y> where X: Foo<'a, Z>
+pub unsafe impl<'a, 'b, X, Y: Foo<Bar>> !Foo<'a, X> for Bar<'b, Y>
+where
+    X: Foo<'a, Z>,
 {
     fn foo() {
         "hi"
@@ -24,24 +31,46 @@ fn foo() {
 }
 
 impl<'a, 'b, X, Y: Foo<Bar>> Foo<'a, X> for Bar<'b, Y>
-    where X: Fooooooooooooooooooooooooooooo<'a, Z>
+where
+    X: Fooooooooooooooooooooooooooooo<'a, Z>,
 {
     fn foo() {
         "hi"
     }
 }
 
-impl<'a, 'b, X, Y: Foo<Bar>> Foo<'a, X> for Bar<'b, Y> where X: Foooooooooooooooooooooooooooo<'a, Z>
+impl<'a, 'b, X, Y: Foo<Bar>> Foo<'a, X> for Bar<'b, Y>
+where
+    X: Foooooooooooooooooooooooooooo<'a, Z>,
 {
     fn foo() {
         "hi"
     }
 }
 
+impl<T> Foo for Bar<T>
+where
+    T: Baz,
+{
+}
+
+impl<T> Foo for Bar<T>
+where
+    T: Baz,
+{
+    // Comment
+}
+
 impl Foo {
     fn foo() {}
 }
 
+impl Boo {
+    // BOO
+    fn boo() {}
+    // FOO
+}
+
 mod a {
     impl Foo {
         // Hello!
@@ -49,7 +78,6 @@ fn foo() {}
     }
 }
 
-
 mod b {
     mod a {
         impl Foo {
@@ -57,3 +85,135 @@ fn foo() {}
         }
     }
 }
+
+impl Foo {
+    add_fun!();
+}
+
+impl Blah {
+    fn boop() {}
+    add_fun!();
+}
+
+impl X {
+    fn do_parse(mut self: X) {}
+}
+
+impl Y5000 {
+    fn bar(self: X<'a, 'b>, y: Y) {}
+
+    fn bad(&self, (x, y): CoorT) {}
+
+    fn turbo_bad(self: X<'a, 'b>, (x, y): CoorT) {}
+}
+
+pub impl<T> Foo for Bar<T>
+where
+    T: Foo,
+{
+    fn foo() {
+        "hi"
+    }
+}
+
+pub impl<T, Z> Foo for Bar<T, Z>
+where
+    T: Foo,
+    Z: Baz,
+{
+}
+
+mod m {
+    impl<T> PartialEq for S<T>
+    where
+        T: PartialEq,
+    {
+        fn eq(&self, other: &Self) {
+            true
+        }
+    }
+
+    impl<T> PartialEq for S<T>
+    where
+        T: PartialEq,
+    {
+    }
+}
+
+impl<BorrowType, K, V, NodeType, HandleType>
+    Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType>
+{
+}
+
+impl<BorrowType, K, V, NodeType, HandleType> PartialEq
+    for Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType>
+{
+}
+
+mod x {
+    impl<A, B, C, D> Foo
+    where
+        A: 'static,
+        B: 'static,
+        C: 'static,
+        D: 'static,
+    {
+    }
+}
+
+impl<ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNodeFoo>
+    Issue1249<ConcreteThreadSafeLayoutNode>
+{
+    // Creates a new flow constructor.
+    fn foo() {}
+}
+
+// #1600
+impl<#[may_dangle] K, #[may_dangle] V> Drop for RawTable<K, V> {
+    fn drop() {}
+}
+
+// #1168
+pub trait Number
+    : Copy
+    + Eq
+    + Not<Output = Self>
+    + Shl<u8, Output = Self>
+    + Shr<u8, Output = Self>
+    + BitAnd<Self, Output = Self>
+    + BitOr<Self, Output = Self>
+    + BitAndAssign
+    + BitOrAssign {
+    // test
+    fn zero() -> Self;
+}
+
+// #1642
+pub trait SomeTrait
+    : Clone
+    + Eq
+    + PartialEq
+    + Ord
+    + PartialOrd
+    + Default
+    + Hash
+    + Debug
+    + Display
+    + Write
+    + Read
+    + FromStr {
+    // comment
+}
+
+// #1995
+impl Foo {
+    fn f(
+        S {
+            aaaaaaaaaa: aaaaaaaaaa,
+            bbbbbbbbbb: bbbbbbbbbb,
+            cccccccccc: cccccccccc,
+        }: S,
+    ) -> u32 {
+        1
+    }
+}