Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove alternative main feature #39337

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/middle/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 0 additions & 2 deletions src/libsyntax/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
9 changes: 1 addition & 8 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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)),
Expand Down Expand Up @@ -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),
Copy link
Member Author

@cramertj cramertj Jan 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems weird that this was ungated. Maybe that has to do with the issue.

Edit: Doesn't look like it. Adding that line back in didn't make any difference.

("test", Normal, Ungated),
("bench", Normal, Ungated),
Expand Down Expand Up @@ -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(..) => {
Expand Down
4 changes: 1 addition & 3 deletions src/libsyntax/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 0 additions & 12 deletions src/test/compile-fail/feature-gate-main.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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.
//
Expand All @@ -7,13 +7,7 @@
// <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.
#![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() {}
6 changes: 1 addition & 5 deletions src/test/compile-fail/lint-dead-code-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#![allow(unused_variables)]
#![deny(dead_code)]
#![feature(main, start)]
#![feature(start)]

struct Foo;

Expand All @@ -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]
Expand All @@ -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();
}
19 changes: 0 additions & 19 deletions src/test/compile-fail/multiple-main-2.rs

This file was deleted.

21 changes: 0 additions & 21 deletions src/test/compile-fail/multiple-main-3.rs

This file was deleted.