@@ -1861,56 +1861,61 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
1861
1861
continue
1862
1862
}
1863
1863
1864
- match attr. meta_item_list ( ) {
1864
+ let list = match attr. meta_item_list ( ) {
1865
+ Some ( list) => list,
1865
1866
None => {
1866
1867
span_err ! ( span_handler, attr. span, E0555 ,
1867
1868
"malformed feature attribute, expected #![feature(...)]" ) ;
1869
+ continue
1870
+ }
1871
+ } ;
1872
+
1873
+ for mi in list {
1874
+ let name = if let Some ( word) = mi. word ( ) {
1875
+ word. name ( )
1876
+ } else {
1877
+ span_err ! ( span_handler, mi. span, E0556 ,
1878
+ "malformed feature, expected just one word" ) ;
1879
+ continue
1880
+ } ;
1881
+
1882
+ if let Some ( ( .., set) ) = ACTIVE_FEATURES . iter ( ) . find ( |f| name == f. 0 ) {
1883
+ set ( & mut features, mi. span ) ;
1884
+ feature_checker. collect ( & features, mi. span ) ;
1885
+ continue
1868
1886
}
1869
- Some ( list) => {
1870
- for mi in list {
1871
1887
1872
- let name = if let Some ( word) = mi. word ( ) {
1873
- word. name ( )
1874
- } else {
1875
- span_err ! ( span_handler, mi. span, E0556 ,
1876
- "malformed feature, expected just one word" ) ;
1877
- continue
1878
- } ;
1879
-
1880
- if let Some ( & ( _, _, _, _, set) ) = ACTIVE_FEATURES . iter ( )
1881
- . find ( |& & ( n, ..) | name == n) {
1882
- set ( & mut features, mi. span ) ;
1883
- feature_checker. collect ( & features, mi. span ) ;
1884
- }
1885
- else if let Some ( & ( .., reason) ) = REMOVED_FEATURES . iter ( )
1886
- . find ( |& & ( n, ..) | name == n)
1887
- . or_else ( || STABLE_REMOVED_FEATURES . iter ( )
1888
- . find ( |& & ( n, ..) | name == n) ) {
1889
- feature_removed ( span_handler, mi. span , reason) ;
1890
- }
1891
- else if let Some ( & ( ..) ) = ACCEPTED_FEATURES . iter ( )
1892
- . find ( |& & ( n, ..) | name == n) {
1893
- features. declared_stable_lang_features . push ( ( name, mi. span ) ) ;
1894
- } else if let Some ( & edition) = ALL_EDITIONS . iter ( )
1895
- . find ( |e| name == e. feature_name ( ) ) {
1896
- if edition <= crate_edition {
1897
- feature_removed ( span_handler, mi. span , None ) ;
1898
- } else {
1899
- for & ( .., f_edition, set) in ACTIVE_FEATURES . iter ( ) {
1900
- if let Some ( f_edition) = f_edition {
1901
- if edition >= f_edition {
1902
- // FIXME(Manishearth) there is currently no way to set
1903
- // lib features by edition
1904
- set ( & mut features, DUMMY_SP ) ;
1905
- }
1906
- }
1907
- }
1888
+ let removed = REMOVED_FEATURES . iter ( ) . find ( |f| name == f. 0 ) ;
1889
+ let stable_removed = STABLE_REMOVED_FEATURES . iter ( ) . find ( |f| name == f. 0 ) ;
1890
+ if let Some ( ( .., reason) ) = removed. or ( stable_removed) {
1891
+ feature_removed ( span_handler, mi. span , * reason) ;
1892
+ continue
1893
+ }
1894
+
1895
+ if ACCEPTED_FEATURES . iter ( ) . any ( |f| name == f. 0 ) {
1896
+ features. declared_stable_lang_features . push ( ( name, mi. span ) ) ;
1897
+ continue
1898
+ }
1899
+
1900
+ if let Some ( edition) = ALL_EDITIONS . iter ( ) . find ( |e| name == e. feature_name ( ) ) {
1901
+ if * edition <= crate_edition {
1902
+ continue
1903
+ }
1904
+
1905
+ for & ( .., f_edition, set) in ACTIVE_FEATURES . iter ( ) {
1906
+ if let Some ( f_edition) = f_edition {
1907
+ if * edition >= f_edition {
1908
+ // FIXME(Manishearth) there is currently no way to set
1909
+ // lib features by edition
1910
+ set ( & mut features, DUMMY_SP ) ;
1908
1911
}
1909
- } else {
1910
- features. declared_lib_features . push ( ( name, mi. span ) ) ;
1911
1912
}
1912
1913
}
1914
+
1915
+ continue
1913
1916
}
1917
+
1918
+ features. declared_lib_features . push ( ( name, mi. span ) ) ;
1914
1919
}
1915
1920
}
1916
1921
0 commit comments