about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-01-20 02:23:49 +0000
committerbors <bors@rust-lang.org>2015-01-20 02:23:49 +0000
commite375a892f194a4c19fd69c1abf91ef3363627a98 (patch)
tree050e9ff72c48a3c96c66576951328debee951098 /src/libsyntax
parent65b61ffb3f55c996eceded6c91281911b671d978 (diff)
parent38cb91e66ca7fc7374909b31598dab09db37edaa (diff)
downloadrust-e375a892f194a4c19fd69c1abf91ef3363627a98.tar.gz
rust-e375a892f194a4c19fd69c1abf91ef3363627a98.zip
Auto merge of #21257 - alexcrichton:issue-20064, r=pnkfelix
These two attributes are used to change the entry point into a Rust program, but
for now they're being put behind feature gates until we have a chance to think
about them a little more. The #[start] attribute specifically may have its
signature changed.

This is a breaking change to due the usage of these attributes generating errors
by default now. If your crate is using these attributes, add this to your crate
root:

    #![feature(start)] // if you're using the #[start] attribute
    #![feature(main)]  // if you're using the #[main] attribute

cc #20064
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/feature_gate.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 9231d4ad659..13b7944998a 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -78,6 +78,8 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
     ("while_let", Accepted),
 
     ("plugin", Active),
+    ("start", Active),
+    ("main", Active),
 
     // A temporary feature gate used to enable parser extensions needed
     // to bootstrap fix for #5723.
@@ -279,6 +281,18 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
                     self.gate_feature("plugin_registrar", i.span,
                                       "compiler plugins are experimental and possibly buggy");
                 }
+                if attr::contains_name(&i.attrs[], "start") {
+                    self.gate_feature("start", i.span,
+                                      "a #[start] function is an experimental \
+                                       feature whose signature may change \
+                                       over time");
+                }
+                if attr::contains_name(&i.attrs[], "main") {
+                    self.gate_feature("main", i.span,
+                                      "declaration of a nonstandard #[main] \
+                                       function may change over time, for now \
+                                       a top-level `fn main()` is required");
+                }
             }
 
             ast::ItemStruct(..) => {