diff options
| author | William Throwe <wtt6@cornell.edu> | 2015-08-24 14:33:22 -0400 |
|---|---|---|
| committer | William Throwe <wtt6@cornell.edu> | 2015-08-24 20:28:24 -0400 |
| commit | 8320a3a048717f2a09ba5e5cddb2b634047da647 (patch) | |
| tree | c95fbde0f5dfda64b87d555b6db18747e7ac96a1 | |
| parent | 0112e7bd159968d2ad2e5ea6727564c200b7c35f (diff) | |
| download | rust-8320a3a048717f2a09ba5e5cddb2b634047da647.tar.gz rust-8320a3a048717f2a09ba5e5cddb2b634047da647.zip | |
Remove #[start] as well as #[main] in --test
Fixes #11766.
| -rw-r--r-- | src/libsyntax/test.rs | 15 | ||||
| -rw-r--r-- | src/test/run-pass/test-runner-hides-start.rs | 16 |
2 files changed, 22 insertions, 9 deletions
diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index 9975e25f493..7fb8cdde311 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -202,8 +202,8 @@ impl fold::Folder for EntryPointCleaner { let folded = fold::noop_fold_item(i, self).expect_one("noop did something"); self.depth -= 1; - // Remove any #[main] from the AST so it doesn't clash with - // the one we're going to add, but mark it as + // Remove any #[main] or #[start] from the AST so it doesn't + // clash with the one we're going to add, but mark it as // #[allow(dead_code)] to avoid printing warnings. let folded = match entry::entry_point_type(&*folded, self.depth) { EntryPointType::MainNamed | @@ -221,13 +221,10 @@ impl fold::Folder for EntryPointCleaner { ast::Item { id: id, ident: ident, - attrs: attrs.into_iter().filter_map(|attr| { - if !attr.check_name("main") { - Some(attr) - } else { - None - } - }) + attrs: attrs.into_iter() + .filter(|attr| { + !attr.check_name("main") && !attr.check_name("start") + }) .chain(iter::once(allow_dead_code)) .collect(), node: node, diff --git a/src/test/run-pass/test-runner-hides-start.rs b/src/test/run-pass/test-runner-hides-start.rs new file mode 100644 index 00000000000..fc94b19ada1 --- /dev/null +++ b/src/test/run-pass/test-runner-hides-start.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: --test + +#![feature(start)] + +#[start] +fn start(_: isize, _: *const *const u8) -> isize { panic!(); } |
