@@ -155,6 +155,10 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
155
155
156
156
// Allows use of unary negate on unsigned integers, e.g. -e for e: u8
157
157
( "negate_unsigned" , "1.0.0" , Active ) ,
158
+
159
+ // Allows the definition of associated constants in `trait` or `impl`
160
+ // blocks.
161
+ ( "associated_consts" , "1.0.0" , Active ) ,
158
162
] ;
159
163
// (changing above list without updating src/doc/reference.md makes @cmr sad)
160
164
@@ -659,6 +663,30 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
659
663
}
660
664
visit:: walk_fn ( self , fn_kind, fn_decl, block, span) ;
661
665
}
666
+
667
+ fn visit_trait_item ( & mut self , ti : & ' v ast:: TraitItem ) {
668
+ match ti. node {
669
+ ast:: ConstTraitItem ( ..) => {
670
+ self . gate_feature ( "associated_consts" ,
671
+ ti. span ,
672
+ "associated constants are experimental" )
673
+ }
674
+ _ => { }
675
+ }
676
+ visit:: walk_trait_item ( self , ti) ;
677
+ }
678
+
679
+ fn visit_impl_item ( & mut self , ii : & ' v ast:: ImplItem ) {
680
+ match ii. node {
681
+ ast:: ConstImplItem ( ..) => {
682
+ self . gate_feature ( "associated_consts" ,
683
+ ii. span ,
684
+ "associated constants are experimental" )
685
+ }
686
+ _ => { }
687
+ }
688
+ visit:: walk_impl_item ( self , ii) ;
689
+ }
662
690
}
663
691
664
692
fn check_crate_inner < F > ( cm : & CodeMap , span_handler : & SpanHandler ,
0 commit comments