From 38cb91e66ca7fc7374909b31598dab09db37edaa Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 16 Jan 2015 10:55:24 -0800 Subject: syntax: Feature gate #[start] and #[main] 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 --- src/libsyntax/feature_gate.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/libsyntax') diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 8929bbe0232..3a4cf184cdf 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -77,6 +77,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. @@ -276,6 +278,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(..) => { -- cgit 1.4.1-3-g733a5