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