2015-04-28 21:53:33 +00:00
|
|
|
// Tests different fns
|
|
|
|
|
2015-11-20 02:11:32 +00:00
|
|
|
fn foo(a: AAAA, b: BBB, c: CCC) -> RetType {}
|
2015-04-28 21:53:33 +00:00
|
|
|
|
2017-06-12 04:01:41 +00:00
|
|
|
fn foo(a: AAAA, b: BBB /* some, weird, inline comment */, c: CCC) -> RetType
|
|
|
|
where
|
|
|
|
T: Blah,
|
|
|
|
{
|
|
|
|
}
|
2015-04-28 21:53:33 +00:00
|
|
|
|
2017-06-12 04:01:41 +00:00
|
|
|
fn foo(a: AAA /* (comment) */)
|
|
|
|
where
|
|
|
|
T: Blah,
|
|
|
|
{
|
|
|
|
}
|
2015-04-28 21:53:33 +00:00
|
|
|
|
2017-06-12 04:01:41 +00:00
|
|
|
fn foo(
|
|
|
|
a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
|
|
|
|
b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
|
|
|
|
) -> RetType
|
|
|
|
where
|
|
|
|
T: Blah,
|
2015-04-28 21:53:33 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-06-12 04:01:41 +00:00
|
|
|
fn foo<U, T>(
|
|
|
|
a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
|
|
|
|
b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
|
|
|
|
) -> RetType
|
|
|
|
where
|
|
|
|
T: Blah,
|
|
|
|
U: dsfasdfasdfasd,
|
2015-04-28 21:53:33 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-11-20 02:11:32 +00:00
|
|
|
fn foo<U: Fn(A) -> B /* paren inside generics */>() {}
|
2015-07-01 23:20:07 +00:00
|
|
|
|
2015-04-28 21:53:33 +00:00
|
|
|
impl Foo {
|
2017-06-12 04:01:41 +00:00
|
|
|
fn with_no_errors<T, F>(&mut self, f: F) -> T
|
|
|
|
where
|
|
|
|
F: FnOnce(&mut Resolver) -> T,
|
|
|
|
{
|
|
|
|
}
|
2015-05-01 11:08:22 +00:00
|
|
|
|
2015-11-20 02:11:32 +00:00
|
|
|
fn foo(mut self, mut bar: u32) {}
|
2015-05-01 11:08:22 +00:00
|
|
|
|
2015-11-20 02:11:32 +00:00
|
|
|
fn bar(self, mut bazz: u32) {}
|
2015-04-28 21:53:33 +00:00
|
|
|
}
|
2015-04-29 04:44:29 +00:00
|
|
|
|
2017-06-12 04:01:41 +00:00
|
|
|
pub fn render<
|
|
|
|
'a,
|
|
|
|
N: Clone + 'a,
|
|
|
|
E: Clone + 'a,
|
|
|
|
G: Labeller<'a, N, E> + GraphWalk<'a, N, E>,
|
2017-06-13 02:49:47 +00:00
|
|
|
W: Write,
|
2017-06-12 04:01:41 +00:00
|
|
|
>(
|
|
|
|
g: &'a G,
|
|
|
|
w: &mut W,
|
|
|
|
) -> io::Result<()> {
|
2015-04-29 04:44:29 +00:00
|
|
|
render_opts(g, w, &[])
|
|
|
|
}
|
2015-05-17 11:35:11 +00:00
|
|
|
|
2015-05-25 11:25:06 +00:00
|
|
|
const fn foo() {
|
|
|
|
x;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub const fn foo() {
|
|
|
|
x;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Foo {
|
|
|
|
const fn foo() {
|
|
|
|
x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-20 02:11:32 +00:00
|
|
|
fn homura<T: Deref<Target = i32>>(_: T) {}
|
2015-09-14 23:40:04 +00:00
|
|
|
|
2015-11-20 02:11:32 +00:00
|
|
|
fn issue377() -> (Box<CompositorProxy + Send>, Box<CompositorReceiver>) {}
|
2015-09-27 20:32:07 +00:00
|
|
|
|
2015-05-17 11:35:11 +00:00
|
|
|
fn main() {
|
|
|
|
let _ = function(move || 5);
|
|
|
|
let _ = move || 42;
|
2015-09-15 05:45:54 +00:00
|
|
|
let _ = || unsafe { abort() };
|
2015-05-17 11:35:11 +00:00
|
|
|
}
|
2015-10-08 04:20:19 +00:00
|
|
|
|
|
|
|
// With inner attributes.
|
|
|
|
fn inner() {
|
|
|
|
#![inline]
|
|
|
|
x
|
|
|
|
}
|
2015-11-30 22:12:50 +00:00
|
|
|
|
2018-05-14 04:25:10 +00:00
|
|
|
#[cfg_attr(rustfmt, rustfmt::skip)]
|
2015-11-30 22:12:50 +00:00
|
|
|
fn foo(a: i32) -> i32 {
|
|
|
|
// comment
|
|
|
|
if a > 0 { 1 } else { 2 }
|
|
|
|
}
|
2015-12-12 14:41:10 +00:00
|
|
|
|
2017-06-12 04:01:41 +00:00
|
|
|
fn ______________________baz(
|
|
|
|
a: i32,
|
2017-06-13 02:49:47 +00:00
|
|
|
) -> *mut ::std::option::Option<
|
2017-06-17 17:04:03 +00:00
|
|
|
extern "C" fn(arg1: i32, _____________________a: i32, arg3: i32) -> (),
|
2017-06-13 02:49:47 +00:00
|
|
|
> {
|
2015-12-12 14:41:10 +00:00
|
|
|
}
|
2016-05-26 23:49:26 +00:00
|
|
|
|
2017-06-12 04:01:41 +00:00
|
|
|
pub fn check_path<'a, 'tcx>(
|
|
|
|
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|
|
|
path: &hir::Path,
|
|
|
|
id: ast::NodeId,
|
|
|
|
cb: &mut FnMut(DefId, Span, &Option<&Stability>, &Option<Depecation>),
|
|
|
|
) {
|
2016-05-26 23:49:26 +00:00
|
|
|
}
|
|
|
|
|
2017-06-12 04:01:41 +00:00
|
|
|
pub fn check_path<'a, 'tcx>(
|
|
|
|
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|
|
|
path: &hir::Path,
|
|
|
|
id: ast::NodeId,
|
|
|
|
cb: &mut FnMut(DefId, Span, &Option<&Stability>, &Option<Deprecation>),
|
|
|
|
) {
|
2016-05-26 23:49:26 +00:00
|
|
|
}
|