diff --git a/src/doc/reference.md b/src/doc/reference.md index dfdfe32882028..90a145513710b 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -1982,8 +1982,6 @@ type int8_t = i8; ### Function-only attributes -- `main` - indicates that this function should be passed to the entry point, - rather than the function in the crate root named `main`. - `plugin_registrar` - mark this function as the registration point for [compiler plugins][plugin], such as loadable syntax extensions. - `start` - indicates that this function should be used as the entry point, diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs index f2e46d4cbc96b..52244623cae99 100644 --- a/src/librustc/middle/entry.rs +++ b/src/librustc/middle/entry.rs @@ -94,8 +94,6 @@ fn entry_point_type(item: &Item, at_root: bool) -> EntryPointType { ItemFn(..) => { if attr::contains_name(&item.attrs, "start") { EntryPointType::Start - } else if attr::contains_name(&item.attrs, "main") { - EntryPointType::MainAttr } else if item.name == "main" { if at_root { // This is a top-level function so can be 'main' diff --git a/src/libsyntax/entry.rs b/src/libsyntax/entry.rs index 93ca1948ed84b..fa455f1e1e486 100644 --- a/src/libsyntax/entry.rs +++ b/src/libsyntax/entry.rs @@ -26,8 +26,6 @@ pub fn entry_point_type(item: &Item, depth: usize) -> EntryPointType { ItemKind::Fn(..) => { if attr::contains_name(&item.attrs, "start") { EntryPointType::Start - } else if attr::contains_name(&item.attrs, "main") { - EntryPointType::MainAttr } else if item.ident.name == "main" { if depth == 1 { // This is a top-level function so can be 'main' diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 3ce3e36d3c252..f0a97e943f6aa 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -129,7 +129,6 @@ declare_features! ( (active, allocator, "1.0.0", Some(27389)), (active, fundamental, "1.0.0", Some(29635)), - (active, main, "1.0.0", Some(29634)), (active, needs_allocator, "1.4.0", Some(27389)), (active, on_unimplemented, "1.0.0", Some(29628)), (active, plugin, "1.0.0", Some(29597)), @@ -334,6 +333,7 @@ declare_features! ( declare_features! ( (removed, import_shadowing, "1.0.0", None), + (removed, main, "1.0.0", Some(29634)), (removed, managed_boxes, "1.0.0", None), // Allows use of unary negate on unsigned integers, e.g. -e for e: u8 (removed, negate_unsigned, "1.0.0", Some(29645)), @@ -468,7 +468,6 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG ("cfg", Normal, Ungated), ("cfg_attr", Normal, Ungated), - ("main", Normal, Ungated), ("start", Normal, Ungated), ("test", Normal, Ungated), ("bench", Normal, Ungated), @@ -1106,12 +1105,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { feature whose signature may change \ over time"); } - if attr::contains_name(&i.attrs[..], "main") { - gate_feature_post!(&self, main, i.span, - "declaration of a nonstandard #[main] \ - function may change over time, for now \ - a top-level `fn main()` is required"); - } } ast::ItemKind::Struct(..) => { diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index 74ec33fdd2a85..c2acc071f55ba 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -202,9 +202,7 @@ impl fold::Folder for EntryPointCleaner { id: id, ident: ident, attrs: attrs.into_iter() - .filter(|attr| { - !attr.check_name("main") && !attr.check_name("start") - }) + .filter(|attr| !attr.check_name("start")) .chain(iter::once(allow_dead_code)) .collect(), node: node, diff --git a/src/test/compile-fail/feature-gate-main.rs b/src/test/compile-fail/feature-gate-main.rs deleted file mode 100644 index db1c1a944172d..0000000000000 --- a/src/test/compile-fail/feature-gate-main.rs +++ /dev/null @@ -1,12 +0,0 @@ -// 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[main] -fn foo() {} //~ ERROR: declaration of a nonstandard #[main] function may change over time diff --git a/src/test/compile-fail/E0137.rs b/src/test/compile-fail/issue-29634.rs similarity index 64% rename from src/test/compile-fail/E0137.rs rename to src/test/compile-fail/issue-29634.rs index f45afc9f37bd5..0dcd049f1ca70 100644 --- a/src/test/compile-fail/E0137.rs +++ b/src/test/compile-fail/issue-29634.rs @@ -1,4 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -7,13 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(main)] //~ ERROR feature has been removed [E0557] -#![feature(main)] - -#[main] -fn foo() {} //~ NOTE first #[main] function - -#[main] -fn f() {} -//~^ ERROR E0137 -//~| NOTE additional #[main] function +#[main] //~ ERROR The attribute `main` is currently unknown to the compiler +pub fn non_main() {} diff --git a/src/test/compile-fail/lint-dead-code-2.rs b/src/test/compile-fail/lint-dead-code-2.rs index 4a0e4f4319e0a..d52afbddc7e3b 100644 --- a/src/test/compile-fail/lint-dead-code-2.rs +++ b/src/test/compile-fail/lint-dead-code-2.rs @@ -10,7 +10,7 @@ #![allow(unused_variables)] #![deny(dead_code)] -#![feature(main, start)] +#![feature(start)] struct Foo; @@ -31,9 +31,6 @@ fn live_fn() {} fn dead_fn() {} //~ ERROR: function is never used -#[main] -fn dead_fn2() {} //~ ERROR: function is never used - fn used_fn() {} #[start] @@ -47,5 +44,4 @@ fn start(_: isize, _: *const *const u8) -> isize { // this is not main fn main() { //~ ERROR: function is never used dead_fn(); - dead_fn2(); } diff --git a/src/test/compile-fail/multiple-main-2.rs b/src/test/compile-fail/multiple-main-2.rs deleted file mode 100644 index d9c232d7dac37..0000000000000 --- a/src/test/compile-fail/multiple-main-2.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(main)] - -#[main] -fn bar() { -} - -#[main] -fn foo() { //~ ERROR multiple functions with a #[main] attribute -} diff --git a/src/test/compile-fail/multiple-main-3.rs b/src/test/compile-fail/multiple-main-3.rs deleted file mode 100644 index 866a59e7a4f62..0000000000000 --- a/src/test/compile-fail/multiple-main-3.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(main)] - -#[main] -fn main1() { -} - -mod foo { - #[main] - fn main2() { //~ ERROR multiple functions with a #[main] attribute - } -}