diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2015-02-25 22:05:07 +0200 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2015-05-21 11:47:30 -0400 |
| commit | af3795721cd9ffc591eeeb077df16d3658be150f (patch) | |
| tree | 045c56da8c0228dd3eed799475c86a0d8ff1dcc4 /src/libsyntax/test.rs | |
| parent | bc6318d2be4d9eb62af9170958fd48ef45e4a74e (diff) | |
| download | rust-af3795721cd9ffc591eeeb077df16d3658be150f.tar.gz rust-af3795721cd9ffc591eeeb077df16d3658be150f.zip | |
syntax: parse `const fn` for free functions and inherent methods.
Diffstat (limited to 'src/libsyntax/test.rs')
| -rw-r--r-- | src/libsyntax/test.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index 458e3f7f0bd..c680d5bbbdf 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -123,7 +123,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> { let i = if is_test_fn(&self.cx, &*i) || is_bench_fn(&self.cx, &*i) { match i.node { - ast::ItemFn(_, ast::Unsafety::Unsafe, _, _, _) => { + ast::ItemFn(_, ast::Unsafety::Unsafe, _, _, _, _) => { let diag = self.cx.span_diagnostic; panic!(diag.span_fatal(i.span, "unsafe functions cannot be used for tests")); } @@ -320,7 +320,7 @@ fn is_test_fn(cx: &TestCtxt, i: &ast::Item) -> bool { fn has_test_signature(i: &ast::Item) -> HasTestSignature { match &i.node { - &ast::ItemFn(ref decl, _, _, ref generics, _) => { + &ast::ItemFn(ref decl, _, _, _, ref generics, _) => { let no_output = match decl.output { ast::DefaultReturn(..) => true, ast::Return(ref t) if t.node == ast::TyTup(vec![]) => true, @@ -356,7 +356,7 @@ fn is_bench_fn(cx: &TestCtxt, i: &ast::Item) -> bool { fn has_test_signature(i: &ast::Item) -> bool { match i.node { - ast::ItemFn(ref decl, _, _, ref generics, _) => { + ast::ItemFn(ref decl, _, _, _, ref generics, _) => { let input_cnt = decl.inputs.len(); let no_output = match decl.output { ast::DefaultReturn(..) => true, @@ -469,7 +469,9 @@ fn mk_main(cx: &mut TestCtxt) -> P<ast::Item> { let main_ret_ty = ecx.ty(sp, ast::TyTup(vec![])); let main_body = ecx.block_all(sp, vec![call_test_main], None); let main = ast::ItemFn(ecx.fn_decl(vec![], main_ret_ty), - ast::Unsafety::Normal, ::abi::Rust, empty_generics(), main_body); + ast::Unsafety::Normal, + ast::Constness::NotConst, + ::abi::Rust, empty_generics(), main_body); let main = P(ast::Item { ident: token::str_to_ident("main"), attrs: vec![main_attr], |
