diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-16 10:55:24 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-16 14:59:03 -0800 |
| commit | 38cb91e66ca7fc7374909b31598dab09db37edaa (patch) | |
| tree | 80aef838e11452ec1a81b7ef8a3ca0858261587a /src/libsyntax | |
| parent | ee2bfae011e368e224d6d4f4c9fad13606ee99da (diff) | |
| download | rust-38cb91e66ca7fc7374909b31598dab09db37edaa.tar.gz rust-38cb91e66ca7fc7374909b31598dab09db37edaa.zip | |
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
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 14 |
1 files changed, 14 insertions, 0 deletions
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(..) => { |
