rust/tests/target/fn.rs

91 lines
1.8 KiB
Rust
Raw Normal View History

2015-04-28 23:53:33 +02:00
// Tests different fns
fn foo(a: AAAA, b: BBB, c: CCC) -> RetType {}
2015-04-28 23:53:33 +02:00
fn foo(a: AAAA, b: BBB /* some, weird, inline comment */, c: CCC) -> RetType where T: Blah {}
2015-04-28 23:53:33 +02:00
fn foo(a: AAA /* (comment) */) where T: Blah {}
2015-04-28 23:53:33 +02:00
fn foo(a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB)
-> RetType
where T: Blah
{
}
fn foo<U, T>(a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB)
-> RetType
where T: Blah,
U: dsfasdfasdfasd
{
}
fn foo<U: Fn(A) -> B /* paren inside generics */>() {}
2015-04-28 23:53:33 +02:00
impl Foo {
fn with_no_errors<T, F>(&mut self, f: F) -> T where F: FnOnce(&mut Resolver) -> T {}
fn foo(mut self, mut bar: u32) {}
fn bar(self, mut bazz: u32) {}
2015-04-28 23:53:33 +02:00
}
2015-04-29 06:44:29 +02:00
2015-05-01 04:52:11 +02:00
pub fn render<'a,
N: Clone + 'a,
E: Clone + 'a,
G: Labeller<'a, N, E> + GraphWalk<'a, N, E>,
W: Write>
2015-04-29 06:44:29 +02:00
(g: &'a G,
w: &mut W)
-> io::Result<()> {
render_opts(g, w, &[])
}
2015-05-17 13:35:11 +02:00
2015-05-25 13:25:06 +02:00
const fn foo() {
x;
}
pub const fn foo() {
x;
}
impl Foo {
const fn foo() {
x;
}
}
fn homura<T: Deref<Target = i32>>(_: T) {}
fn issue377() -> (Box<CompositorProxy + Send>, Box<CompositorReceiver>) {}
2015-05-17 13:35:11 +02:00
fn main() {
let _ = function(move || 5);
let _ = move || 42;
let _ = || unsafe { abort() };
2015-05-17 13:35:11 +02:00
}
// With inner attributes.
fn inner() {
#![inline]
x
}
#[cfg_attr(rustfmt, rustfmt_skip)]
fn foo(a: i32) -> i32 {
// comment
if a > 0 { 1 } else { 2 }
}
fn ______________________baz(a: i32)
->
*mut ::std::option::Option<extern "C" fn(arg1: i32,
_____________________a: i32,
arg3: i32)
-> ()> {
}