]> git.lizzy.rs Git - rust.git/blob - tests/target/multiple.rs
2ec281ae04ee9d50b68acf43052eefb0d291c51e
[rust.git] / tests / target / multiple.rs
1 // Test of lots of random stuff.
2 // FIXME split this into multiple, self-contained tests.
3
4
5 #[attr1]
6 extern crate foo;
7 #[attr2]
8 #[attr3]
9 extern crate foo;
10 #[attr1]
11 extern crate foo;
12 #[attr2]
13 #[attr3]
14 extern crate foo;
15
16 use std::cell::*;
17 use std::{self, any, ascii, borrow, boxed, char, borrow, boxed, char, borrow, borrow, boxed, char,
18           borrow, boxed, char, borrow, boxed, char, borrow, boxed, char, borrow, boxed, char,
19           borrow, boxed, char, borrow, boxed, char, borrow, boxed, char};
20
21 mod doc;
22 mod other;
23
24
25 // sfdgfffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffff
26
27 fn foo(a: isize, b: u32 /* blah blah */, c: f64) {
28
29 }
30
31 fn foo() -> Box<Write + 'static>
32     where 'a: 'b,
33           for<'a> D<'b>: 'a
34 {
35     hello!()
36 }
37
38 fn baz<'a: 'b, // comment on 'a
39        T: SomsssssssssssssssssssssssssssssssssssssssssssssssssssssseType /* comment on T */>
40     (a: A,
41      b: B, // comment on b
42      c: C)
43      -> Bob {
44     #[attr1]
45     extern crate foo;
46     #[attr2]
47     #[attr3]
48     extern crate foo;
49     #[attr1]
50     extern crate foo;
51     #[attr2]
52     #[attr3]
53     extern crate foo;
54 }
55
56 #[rustfmt_skip]
57 fn qux(a: dadsfa,   // Comment 1
58        b: sdfasdfa, // Comment 2
59        c: dsfdsafa) // Comment 3
60 {
61
62 }
63
64 /// Blah blah blah.
65 impl Bar {
66     fn foo(&mut self,
67            a: sdfsdfcccccccccccccccccccccccccccccccccccccccccccccccccc, // comment on a
68            b: sdfasdfsdfasfs /* closing comment */)
69            -> isize {
70     }
71
72     /// Blah blah blah.
73     pub fn f2(self) {
74         (foo, bar)
75     }
76
77     #[an_attribute]
78     fn f3(self) -> Dog {
79     }
80 }
81
82 /// The `nodes` and `edges` method each return instantiations of
83 /// `Cow<[T]>` to leave implementers the freedom to create
84
85 /// entirely new vectors or to pass back slices into internally owned
86 /// vectors.
87 pub trait GraphWalk<'a, N, E> {
88     /// Returns all the nodes in this graph.
89     fn nodes(&'a self) -> Nodes<'a, N>;
90     /// Returns all of the edges in this graph.
91     fn edges(&'a self) -> Edges<'a, E>;
92     /// The source node for `edge`.
93     fn source(&'a self, edge: &E) -> N;
94     /// The target node for `edge`.
95     fn target(&'a self, edge: &E) -> N;
96 }
97
98 /// A Doc comment
99 #[AnAttribute]
100 pub struct Foo {
101     #[rustfmt_skip]
102     f :   SomeType, // Comment beside a field
103     f: SomeType, // Comment beside a field
104     // Comment on a field
105     g: SomeOtherType,
106     /// A doc comment on a field
107     h: AThirdType,
108 }
109
110 struct Bar;
111
112 // With a where clause and generics.
113 pub struct Foo<'a, Y: Baz>
114     where X: Whatever
115 {
116     f: SomeType, // Comment beside a field
117 }
118
119 fn foo(ann: &'a (PpAnn + 'a)) {
120 }
121
122 fn main() {
123     for i in 0i32..4 {
124         println!("{}", i);
125     }
126
127
128     while true {
129         hello();
130     }
131
132     let rc = Cell::new(42usize,
133                        42usize,
134                        Cell::new(42usize,
135                                  remaining_widthremaining_widthremaining_widthremaining_width),
136                        42usize);
137     let rc = RefCell::new(42usize, remaining_width, remaining_width);  // a comment
138     let x = "Hello!!!!!!!!! abcd  abcd abcd abcd abcd abcd\n abcd abcd abcd abcd abcd abcd abcd \
139              abcd abcd abcd  abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \
140              abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \
141              abcd abcd";
142     let s = expand(a, b);
143 }