@@ -1833,6 +1833,58 @@ fn main() {
1833
1833
> individual functions, structs, methods and enum variants, * not* to
1834
1834
> entire modules, traits, impls or enums themselves.
1835
1835
1836
+ ### Compiler Features
1837
+
1838
+ Certain aspects of Rust may be implemented in the compiler, but they're not
1839
+ necessarily ready for every-day use. These features are often of "prototype
1840
+ quality" or "almost production ready", but may not be stable enough to be
1841
+ considered a full-fleged language feature.
1842
+
1843
+ For this reason, rust recognizes a special crate-level attribute of the form:
1844
+
1845
+ ~~~ {.xfail-test}
1846
+ #[feature(feature1, feature2, feature3)]
1847
+ ~~~
1848
+
1849
+ This directive informs the compiler that the feature list: ` feature1 ` ,
1850
+ ` feature2 ` , and ` feature3 ` should all be enabled. This is only recognized at a
1851
+ crate-level, not at a module-level. Without this directive, all features are
1852
+ considered off, and using the features will result in a compiler error.
1853
+
1854
+ The currently implemented features of the compiler are:
1855
+
1856
+ * ` macro_rules ` - The definition of new macros. This does not encompass
1857
+ macro-invocation, that is always enabled by default, this only
1858
+ covers the definition of new macros. There are currently
1859
+ various problems with invoking macros, how they interact with
1860
+ their environment, and possibly how they are used outside of
1861
+ location in which they are defined. Macro definitions are
1862
+ likely to change slightly in the future, so they are currently
1863
+ hidden behind this feature.
1864
+
1865
+ * ` globs ` - Importing everything in a module through ` * ` . This is currently a
1866
+ large source of bugs in name resolution for Rust, and it's not clear
1867
+ whether this will continue as a feature or not. For these reasons,
1868
+ the glob import statement has been hidden behind this feature flag.
1869
+
1870
+ * ` struct_variant ` - Structural enum variants (those with named fields). It is
1871
+ currently unknown whether this style of enum variant is as
1872
+ fully supported as the tuple-forms, and it's not certain
1873
+ that this style of variant should remain in the language.
1874
+ For now this style of variant is hidden behind a feature
1875
+ flag.
1876
+
1877
+ If a feature is promoted to a language feature, then all existing programs will
1878
+ start to receive compilation warnings about #[ feature] directives which enabled
1879
+ the new feature (because the directive is no longer necessary). However, if
1880
+ a feature is decided to be removed from the language, errors will be issued (if
1881
+ there isn't a parser error first). The directive in this case is no longer
1882
+ necessary, and it's likely that existing code will break if the feature isn't
1883
+ removed.
1884
+
1885
+ If a unknown feature is found in a directive, it results in a compiler error. An
1886
+ unknown feature is one which has never been recognized by the compiler.
1887
+
1836
1888
# Statements and expressions
1837
1889
1838
1890
Rust is _ primarily_ an expression language. This means that most forms of
0 commit comments